1#![doc = r" This module contains the generated types for the library."]
2#[cfg(feature = "tabled")]
3use tabled::Tabled;
4pub mod base64 {
5 #![doc = " Base64 data that encodes to url safe base64, but can decode from multiple"]
6 #![doc = " base64 implementations to account for various clients and libraries. Compatible"]
7 #![doc = " with serde and JsonSchema."]
8 use serde::{
9 de::{Error, Unexpected, Visitor},
10 Deserialize, Deserializer, Serialize, Serializer,
11 };
12 use std::{convert::TryFrom, fmt};
13 static ALLOWED_DECODING_FORMATS: &[data_encoding::Encoding] = &[
14 data_encoding::BASE64,
15 data_encoding::BASE64URL,
16 data_encoding::BASE64URL_NOPAD,
17 data_encoding::BASE64_MIME,
18 data_encoding::BASE64_NOPAD,
19 ];
20 #[derive(Debug, Clone, PartialEq, Eq)]
21 #[doc = " A container for binary that should be base64 encoded in serialisation. In reverse"]
22 #[doc = " when deserializing, will decode from many different types of base64 possible."]
23 pub struct Base64Data(pub Vec<u8>);
24 impl Base64Data {
25 #[doc = " Return is the data is empty."]
26 pub fn is_empty(&self) -> bool {
27 self.0.is_empty()
28 }
29 }
30
31 impl fmt::Display for Base64Data {
32 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
33 write!(f, "{}", data_encoding::BASE64URL_NOPAD.encode(&self.0))
34 }
35 }
36
37 impl From<Base64Data> for Vec<u8> {
38 fn from(data: Base64Data) -> Vec<u8> {
39 data.0
40 }
41 }
42
43 impl From<Vec<u8>> for Base64Data {
44 fn from(data: Vec<u8>) -> Base64Data {
45 Base64Data(data)
46 }
47 }
48
49 impl AsRef<[u8]> for Base64Data {
50 fn as_ref(&self) -> &[u8] {
51 &self.0
52 }
53 }
54
55 impl TryFrom<&str> for Base64Data {
56 type Error = anyhow::Error;
57 fn try_from(v: &str) -> Result<Self, Self::Error> {
58 for config in ALLOWED_DECODING_FORMATS {
59 if let Ok(data) = config.decode(v.as_bytes()) {
60 return Ok(Base64Data(data));
61 }
62 }
63 anyhow::bail!("Could not decode base64 data: {v}");
64 }
65 }
66
67 struct Base64DataVisitor;
68 impl Visitor<'_> for Base64DataVisitor {
69 type Value = Base64Data;
70 fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
71 write!(formatter, "a base64 encoded string")
72 }
73
74 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
75 where
76 E: Error,
77 {
78 for config in ALLOWED_DECODING_FORMATS {
79 if let Ok(data) = config.decode(v.as_bytes()) {
80 return Ok(Base64Data(data));
81 }
82 }
83 Err(serde::de::Error::invalid_value(Unexpected::Str(v), &self))
84 }
85 }
86
87 impl<'de> Deserialize<'de> for Base64Data {
88 fn deserialize<D>(deserializer: D) -> Result<Self, <D as Deserializer<'de>>::Error>
89 where
90 D: Deserializer<'de>,
91 {
92 deserializer.deserialize_str(Base64DataVisitor)
93 }
94 }
95
96 impl Serialize for Base64Data {
97 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
98 where
99 S: Serializer,
100 {
101 let encoded = data_encoding::BASE64URL_NOPAD.encode(&self.0);
102 serializer.serialize_str(&encoded)
103 }
104 }
105
106 impl schemars::JsonSchema for Base64Data {
107 fn schema_name() -> String {
108 "Base64Data".to_string()
109 }
110
111 fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
112 let mut obj = gen.root_schema_for::<String>().schema;
113 obj.format = Some("byte".to_string());
114 schemars::schema::Schema::Object(obj)
115 }
116
117 fn is_referenceable() -> bool {
118 false
119 }
120 }
121
122 #[cfg(test)]
123 mod tests {
124 use super::Base64Data;
125 use std::convert::TryFrom;
126 #[test]
127 fn test_base64_try_from() {
128 assert!(Base64Data::try_from("aGVsbG8=").is_ok());
129 assert!(Base64Data::try_from("abcdefghij").is_err());
130 }
131 }
132}
133
134#[cfg(feature = "requests")]
135pub mod multipart {
136 #![doc = " Multipart form data types."]
137 use std::path::PathBuf;
138 #[doc = " An attachement to a multipart form."]
139 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
140 pub struct Attachment {
141 #[doc = " The name of the field."]
142 pub name: String,
143 #[doc = " The file path of the attachment."]
144 pub filepath: Option<PathBuf>,
145 #[doc = " The content type of the attachment."]
146 pub content_type: Option<String>,
147 #[doc = " The data of the attachment."]
148 pub data: Vec<u8>,
149 }
150
151 impl std::convert::TryFrom<Attachment> for reqwest::multipart::Part {
152 type Error = reqwest::Error;
153 fn try_from(attachment: Attachment) -> Result<Self, Self::Error> {
154 let mut part = reqwest::multipart::Part::bytes(attachment.data);
155 if let Some(filepath) = attachment.filepath {
156 part = part.file_name(filepath.to_string_lossy().to_string());
157 }
158 if let Some(content_type) = attachment.content_type {
159 part = part.mime_str(&content_type)?;
160 }
161 Ok(part)
162 }
163 }
164
165 impl std::convert::TryFrom<std::path::PathBuf> for Attachment {
166 type Error = std::io::Error;
167 fn try_from(path: std::path::PathBuf) -> Result<Self, Self::Error> {
168 let content_type = mime_guess::from_path(&path).first_raw();
169 let data = std::fs::read(&path)?;
170 Ok(Attachment {
171 name: "file".to_string(),
172 filepath: Some(path),
173 content_type: content_type.map(|s| s.to_string()),
174 data,
175 })
176 }
177 }
178}
179
180#[cfg(feature = "requests")]
181pub mod paginate {
182 #![doc = " Utility functions used for pagination."]
183 use anyhow::Result;
184 #[doc = " A trait for types that allow pagination."]
185 pub trait Pagination {
186 #[doc = " The item that is paginated."]
187 type Item: serde::de::DeserializeOwned;
188 #[doc = " Returns true if the response has more pages."]
189 fn has_more_pages(&self) -> bool;
190 #[doc = " Returns the next page token."]
191 fn next_page_token(&self) -> Option<String>;
192 #[doc = " Modify a request to get the next page."]
193 fn next_page(
194 &self,
195 req: reqwest::Request,
196 ) -> Result<reqwest::Request, crate::types::error::Error>;
197 #[doc = " Get the items from a page."]
198 fn items(&self) -> Vec<Self::Item>;
199 }
200}
201
202pub mod phone_number {
203 #![doc = " A library to implement phone numbers for our database and JSON serialization and deserialization."]
204 use schemars::JsonSchema;
205 use std::str::FromStr;
206 #[doc = " A phone number."]
207 #[derive(Debug, Default, Clone, PartialEq, Hash, Eq)]
208 pub struct PhoneNumber(pub Option<phonenumber::PhoneNumber>);
209 impl From<phonenumber::PhoneNumber> for PhoneNumber {
210 fn from(id: phonenumber::PhoneNumber) -> PhoneNumber {
211 PhoneNumber(Some(id))
212 }
213 }
214
215 impl AsRef<Option<phonenumber::PhoneNumber>> for PhoneNumber {
216 fn as_ref(&self) -> &Option<phonenumber::PhoneNumber> {
217 &self.0
218 }
219 }
220
221 impl std::ops::Deref for PhoneNumber {
222 type Target = Option<phonenumber::PhoneNumber>;
223 fn deref(&self) -> &Self::Target {
224 &self.0
225 }
226 }
227
228 impl serde::ser::Serialize for PhoneNumber {
229 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
230 where
231 S: serde::ser::Serializer,
232 {
233 serializer.serialize_str(&self.to_string())
234 }
235 }
236
237 impl<'de> serde::de::Deserialize<'de> for PhoneNumber {
238 fn deserialize<D>(deserializer: D) -> Result<PhoneNumber, D::Error>
239 where
240 D: serde::de::Deserializer<'de>,
241 {
242 let s = String::deserialize(deserializer).unwrap_or_default();
243 PhoneNumber::from_str(&s).map_err(serde::de::Error::custom)
244 }
245 }
246
247 impl std::str::FromStr for PhoneNumber {
248 type Err = anyhow::Error;
249 fn from_str(s: &str) -> Result<Self, Self::Err> {
250 if s.trim().is_empty() {
251 return Ok(PhoneNumber(None));
252 }
253 let s = if !s.trim().starts_with('+') {
254 format!("+1{s}")
255 } else {
256 s.to_string()
257 }
258 .replace(['-', '(', ')', ' '], "");
259 Ok(PhoneNumber(Some(phonenumber::parse(None, &s).map_err(
260 |e| anyhow::anyhow!("invalid phone number `{s}`: {e}"),
261 )?)))
262 }
263 }
264
265 impl std::fmt::Display for PhoneNumber {
266 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
267 let s = if let Some(phone) = &self.0 {
268 phone
269 .format()
270 .mode(phonenumber::Mode::International)
271 .to_string()
272 } else {
273 String::new()
274 };
275 write!(f, "{s}")
276 }
277 }
278
279 impl JsonSchema for PhoneNumber {
280 fn schema_name() -> String {
281 "PhoneNumber".to_string()
282 }
283
284 fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
285 let mut obj = gen.root_schema_for::<String>().schema;
286 obj.format = Some("phone".to_string());
287 schemars::schema::Schema::Object(obj)
288 }
289
290 fn is_referenceable() -> bool {
291 false
292 }
293 }
294
295 #[cfg(test)]
296 mod test {
297 use super::PhoneNumber;
298 use pretty_assertions::assert_eq;
299 #[test]
300 fn test_parse_phone_number() {
301 let mut phone = "+1-555-555-5555";
302 let mut phone_parsed: PhoneNumber =
303 serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
304 let mut expected = PhoneNumber(Some(phonenumber::parse(None, phone).unwrap()));
305 assert_eq!(phone_parsed, expected);
306 let mut expected_str = "+1 555-555-5555";
307 assert_eq!(expected_str, serde_json::json!(phone_parsed));
308 phone = "555-555-5555";
309 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
310 assert_eq!(phone_parsed, expected);
311 assert_eq!(expected_str, serde_json::json!(phone_parsed));
312 phone = "+1 555-555-5555";
313 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
314 assert_eq!(phone_parsed, expected);
315 assert_eq!(expected_str, serde_json::json!(phone_parsed));
316 phone = "5555555555";
317 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
318 assert_eq!(phone_parsed, expected);
319 assert_eq!(expected_str, serde_json::json!(phone_parsed));
320 phone = "(510) 864-1234";
321 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
322 expected = PhoneNumber(Some(phonenumber::parse(None, "+15108641234").unwrap()));
323 assert_eq!(phone_parsed, expected);
324 expected_str = "+1 510-864-1234";
325 assert_eq!(expected_str, serde_json::json!(phone_parsed));
326 phone = "(510)8641234";
327 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
328 assert_eq!(phone_parsed, expected);
329 expected_str = "+1 510-864-1234";
330 assert_eq!(expected_str, serde_json::json!(phone_parsed));
331 phone = "";
332 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
333 assert_eq!(phone_parsed, PhoneNumber(None));
334 assert_eq!("", serde_json::json!(phone_parsed));
335 phone = "+49 30 1234 1234";
336 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
337 expected = PhoneNumber(Some(phonenumber::parse(None, phone).unwrap()));
338 assert_eq!(phone_parsed, expected);
339 expected_str = "+49 30 12341234";
340 assert_eq!(expected_str, serde_json::json!(phone_parsed));
341 }
342 }
343}
344
345#[cfg(feature = "requests")]
346pub mod error {
347 #![doc = " Error methods."]
348 #[doc = " Error produced by generated client methods."]
349 pub enum Error {
350 #[doc = " The request did not conform to API requirements."]
351 InvalidRequest(String),
352 #[cfg(feature = "retry")]
353 #[doc = " A server error either due to the data, or with the connection."]
354 CommunicationError(reqwest_middleware::Error),
355 #[doc = " A request error, caused when building the request."]
356 RequestError(reqwest::Error),
357 #[doc = " An expected response whose deserialization failed."]
358 SerdeError {
359 #[doc = " The error."]
360 error: format_serde_error::SerdeError,
361 #[doc = " The response status."]
362 status: reqwest::StatusCode,
363 },
364 #[doc = " An expected error response."]
365 InvalidResponsePayload {
366 #[cfg(feature = "retry")]
367 #[doc = " The error."]
368 error: reqwest_middleware::Error,
369 #[cfg(not(feature = "retry"))]
370 #[doc = " The error."]
371 error: reqwest::Error,
372 #[doc = " The full response."]
373 response: reqwest::Response,
374 },
375 #[doc = " An error from the server."]
376 Server {
377 #[doc = " The text from the body."]
378 body: String,
379 #[doc = " The response status."]
380 status: reqwest::StatusCode,
381 },
382 #[doc = " A response not listed in the API description. This may represent a"]
383 #[doc = " success or failure response; check `status().is_success()`."]
384 UnexpectedResponse(reqwest::Response),
385 }
386
387 impl Error {
388 #[doc = " Returns the status code, if the error was generated from a response."]
389 pub fn status(&self) -> Option<reqwest::StatusCode> {
390 match self {
391 Error::InvalidRequest(_) => None,
392 Error::RequestError(e) => e.status(),
393 #[cfg(feature = "retry")]
394 Error::CommunicationError(reqwest_middleware::Error::Reqwest(e)) => e.status(),
395 #[cfg(feature = "retry")]
396 Error::CommunicationError(reqwest_middleware::Error::Middleware(_)) => None,
397 Error::SerdeError { error: _, status } => Some(*status),
398 Error::InvalidResponsePayload { error: _, response } => Some(response.status()),
399 Error::Server { body: _, status } => Some(*status),
400 Error::UnexpectedResponse(r) => Some(r.status()),
401 }
402 }
403
404 #[doc = " Creates a new error from a response status and a serde error."]
405 pub fn from_serde_error(
406 e: format_serde_error::SerdeError,
407 status: reqwest::StatusCode,
408 ) -> Self {
409 Self::SerdeError { error: e, status }
410 }
411 }
412
413 #[cfg(feature = "retry")]
414 impl From<reqwest_middleware::Error> for Error {
415 fn from(e: reqwest_middleware::Error) -> Self {
416 Self::CommunicationError(e)
417 }
418 }
419
420 impl From<reqwest::Error> for Error {
421 fn from(e: reqwest::Error) -> Self {
422 Self::RequestError(e)
423 }
424 }
425
426 impl From<serde_json::Error> for Error {
427 fn from(e: serde_json::Error) -> Self {
428 Self::SerdeError {
429 error: format_serde_error::SerdeError::new(String::new(), e),
430 status: reqwest::StatusCode::INTERNAL_SERVER_ERROR,
431 }
432 }
433 }
434
435 impl std::fmt::Display for Error {
436 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
437 match self {
438 Error::InvalidRequest(s) => {
439 write!(f, "Invalid Request: {s}")
440 }
441 #[cfg(feature = "retry")]
442 Error::CommunicationError(e) => {
443 write!(f, "Communication Error: {e}")
444 }
445 Error::RequestError(e) => {
446 write!(f, "Request Error: {e}")
447 }
448 Error::SerdeError { error, status: _ } => {
449 write!(f, "Serde Error: {error}")
450 }
451 Error::InvalidResponsePayload { error, response: _ } => {
452 write!(f, "Invalid Response Payload: {error}")
453 }
454 Error::Server { body, status } => {
455 write!(f, "Server Error: {status} {body}")
456 }
457 Error::UnexpectedResponse(r) => {
458 write!(f, "Unexpected Response: {r:?}")
459 }
460 }
461 }
462 }
463
464 impl std::fmt::Debug for Error {
465 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
466 std::fmt::Display::fmt(self, f)
467 }
468 }
469
470 impl std::error::Error for Error {
471 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
472 match self {
473 #[cfg(feature = "retry")]
474 Error::CommunicationError(e) => Some(e),
475 Error::SerdeError { error, status: _ } => Some(error),
476 Error::InvalidResponsePayload { error, response: _ } => Some(error),
477 _ => None,
478 }
479 }
480 }
481}
482
483#[derive(
484 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
485)]
486#[allow(non_snake_case)]
487pub struct AcknowledgeTasks {
488 pub result: i64,
489}
490
491impl std::fmt::Display for AcknowledgeTasks {
492 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
493 write!(
494 f,
495 "{}",
496 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
497 )
498 }
499}
500
501#[cfg(feature = "tabled")]
502impl tabled::Tabled for AcknowledgeTasks {
503 const LENGTH: usize = 1;
504 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
505 vec![format!("{:?}", self.result).into()]
506 }
507
508 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
509 vec!["result".into()]
510 }
511}
512
513#[derive(
514 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
515)]
516#[allow(non_snake_case)]
517pub struct Actor {
518 pub id: i64,
519 pub username: String,
520}
521
522impl std::fmt::Display for Actor {
523 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
524 write!(
525 f,
526 "{}",
527 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
528 )
529 }
530}
531
532#[cfg(feature = "tabled")]
533impl tabled::Tabled for Actor {
534 const LENGTH: usize = 2;
535 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
536 vec![
537 format!("{:?}", self.id).into(),
538 self.username.clone().into(),
539 ]
540 }
541
542 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
543 vec!["id".into(), "username".into()]
544 }
545}
546
547#[derive(
548 serde :: Serialize,
549 serde :: Deserialize,
550 PartialEq,
551 Hash,
552 Debug,
553 Clone,
554 schemars :: JsonSchema,
555 parse_display :: FromStr,
556 parse_display :: Display,
557)]
558#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
559#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
560pub enum OutputType {
561 #[serde(rename = "pdf")]
562 #[display("pdf")]
563 Pdf,
564 #[serde(rename = "pdfa")]
565 #[display("pdfa")]
566 Pdfa,
567 #[serde(rename = "pdfa-1")]
568 #[display("pdfa-1")]
569 Pdfa1,
570 #[serde(rename = "pdfa-2")]
571 #[display("pdfa-2")]
572 Pdfa2,
573 #[serde(rename = "pdfa-3")]
574 #[display("pdfa-3")]
575 Pdfa3,
576 #[serde(rename = "")]
577 #[display("")]
578 Empty,
579}
580
581#[derive(
582 serde :: Serialize,
583 serde :: Deserialize,
584 PartialEq,
585 Hash,
586 Debug,
587 Clone,
588 schemars :: JsonSchema,
589 parse_display :: FromStr,
590 parse_display :: Display,
591)]
592#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
593#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
594pub enum Mode {
595 #[serde(rename = "skip")]
596 #[display("skip")]
597 Skip,
598 #[serde(rename = "redo")]
599 #[display("redo")]
600 Redo,
601 #[serde(rename = "force")]
602 #[display("force")]
603 Force,
604 #[serde(rename = "skip_noarchive")]
605 #[display("skip_noarchive")]
606 SkipNoarchive,
607 #[serde(rename = "")]
608 #[display("")]
609 Empty,
610}
611
612#[derive(
613 serde :: Serialize,
614 serde :: Deserialize,
615 PartialEq,
616 Hash,
617 Debug,
618 Clone,
619 schemars :: JsonSchema,
620 parse_display :: FromStr,
621 parse_display :: Display,
622)]
623#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
624#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
625pub enum SkipArchiveFile {
626 #[serde(rename = "never")]
627 #[display("never")]
628 Never,
629 #[serde(rename = "with_text")]
630 #[display("with_text")]
631 WithText,
632 #[serde(rename = "always")]
633 #[display("always")]
634 Always,
635 #[serde(rename = "")]
636 #[display("")]
637 Empty,
638}
639
640#[derive(
641 serde :: Serialize,
642 serde :: Deserialize,
643 PartialEq,
644 Hash,
645 Debug,
646 Clone,
647 schemars :: JsonSchema,
648 parse_display :: FromStr,
649 parse_display :: Display,
650)]
651#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
652#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
653pub enum UnpaperClean {
654 #[serde(rename = "clean")]
655 #[display("clean")]
656 Clean,
657 #[serde(rename = "clean-final")]
658 #[display("clean-final")]
659 CleanFinal,
660 #[serde(rename = "none")]
661 #[display("none")]
662 None,
663 #[serde(rename = "")]
664 #[display("")]
665 Empty,
666}
667
668#[derive(
669 serde :: Serialize,
670 serde :: Deserialize,
671 PartialEq,
672 Hash,
673 Debug,
674 Clone,
675 schemars :: JsonSchema,
676 parse_display :: FromStr,
677 parse_display :: Display,
678)]
679#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
680#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
681pub enum ColorConversionStrategy {
682 LeaveColorUnchanged,
683 #[serde(rename = "RGB")]
684 #[display("RGB")]
685 Rgb,
686 UseDeviceIndependentColor,
687 Gray,
688 #[serde(rename = "CMYK")]
689 #[display("CMYK")]
690 Cmyk,
691 #[serde(rename = "")]
692 #[display("")]
693 Empty,
694}
695
696#[derive(
697 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
698)]
699#[allow(non_snake_case)]
700pub struct ApplicationConfiguration {
701 pub id: i64,
702 #[serde(default)]
703 pub user_args: Option<serde_json::Value>,
704 #[serde(default)]
705 pub barcode_tag_mapping: Option<serde_json::Value>,
706 #[serde(default, skip_serializing_if = "Option::is_none")]
707 pub output_type: Option<OutputType>,
708 #[serde(default, skip_serializing_if = "Option::is_none")]
709 pub pages: Option<i64>,
710 #[serde(default, skip_serializing_if = "Option::is_none")]
711 pub language: Option<String>,
712 #[serde(default, skip_serializing_if = "Option::is_none")]
713 pub mode: Option<Mode>,
714 #[serde(default, skip_serializing_if = "Option::is_none")]
715 pub skip_archive_file: Option<SkipArchiveFile>,
716 #[serde(default, skip_serializing_if = "Option::is_none")]
717 pub image_dpi: Option<i64>,
718 #[serde(default, skip_serializing_if = "Option::is_none")]
719 pub unpaper_clean: Option<UnpaperClean>,
720 #[serde(default, skip_serializing_if = "Option::is_none")]
721 pub deskew: Option<bool>,
722 #[serde(default, skip_serializing_if = "Option::is_none")]
723 pub rotate_pages: Option<bool>,
724 #[serde(default, skip_serializing_if = "Option::is_none")]
725 pub rotate_pages_threshold: Option<f64>,
726 #[serde(default, skip_serializing_if = "Option::is_none")]
727 pub max_image_pixels: Option<f64>,
728 #[serde(default, skip_serializing_if = "Option::is_none")]
729 pub color_conversion_strategy: Option<ColorConversionStrategy>,
730 #[serde(default, skip_serializing_if = "Option::is_none")]
731 pub app_title: Option<String>,
732 #[serde(default, skip_serializing_if = "Option::is_none")]
733 pub app_logo: Option<String>,
734 #[serde(default, skip_serializing_if = "Option::is_none")]
735 pub barcodes_enabled: Option<bool>,
736 #[serde(default, skip_serializing_if = "Option::is_none")]
737 pub barcode_enable_tiff_support: Option<bool>,
738 #[serde(default, skip_serializing_if = "Option::is_none")]
739 pub barcode_string: Option<String>,
740 #[serde(default, skip_serializing_if = "Option::is_none")]
741 pub barcode_retain_split_pages: Option<bool>,
742 #[serde(default, skip_serializing_if = "Option::is_none")]
743 pub barcode_enable_asn: Option<bool>,
744 #[serde(default, skip_serializing_if = "Option::is_none")]
745 pub barcode_asn_prefix: Option<String>,
746 #[serde(default, skip_serializing_if = "Option::is_none")]
747 pub barcode_upscale: Option<f64>,
748 #[serde(default, skip_serializing_if = "Option::is_none")]
749 pub barcode_dpi: Option<i64>,
750 #[serde(default, skip_serializing_if = "Option::is_none")]
751 pub barcode_max_pages: Option<i64>,
752 #[serde(default, skip_serializing_if = "Option::is_none")]
753 pub barcode_enable_tag: Option<bool>,
754}
755
756impl std::fmt::Display for ApplicationConfiguration {
757 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
758 write!(
759 f,
760 "{}",
761 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
762 )
763 }
764}
765
766#[cfg(feature = "tabled")]
767impl tabled::Tabled for ApplicationConfiguration {
768 const LENGTH: usize = 27;
769 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
770 vec![
771 format!("{:?}", self.id).into(),
772 format!("{:?}", self.user_args).into(),
773 format!("{:?}", self.barcode_tag_mapping).into(),
774 if let Some(output_type) = &self.output_type {
775 format!("{output_type:?}").into()
776 } else {
777 String::new().into()
778 },
779 if let Some(pages) = &self.pages {
780 format!("{pages:?}").into()
781 } else {
782 String::new().into()
783 },
784 if let Some(language) = &self.language {
785 format!("{language:?}").into()
786 } else {
787 String::new().into()
788 },
789 if let Some(mode) = &self.mode {
790 format!("{mode:?}").into()
791 } else {
792 String::new().into()
793 },
794 if let Some(skip_archive_file) = &self.skip_archive_file {
795 format!("{skip_archive_file:?}").into()
796 } else {
797 String::new().into()
798 },
799 if let Some(image_dpi) = &self.image_dpi {
800 format!("{image_dpi:?}").into()
801 } else {
802 String::new().into()
803 },
804 if let Some(unpaper_clean) = &self.unpaper_clean {
805 format!("{unpaper_clean:?}").into()
806 } else {
807 String::new().into()
808 },
809 if let Some(deskew) = &self.deskew {
810 format!("{deskew:?}").into()
811 } else {
812 String::new().into()
813 },
814 if let Some(rotate_pages) = &self.rotate_pages {
815 format!("{rotate_pages:?}").into()
816 } else {
817 String::new().into()
818 },
819 if let Some(rotate_pages_threshold) = &self.rotate_pages_threshold {
820 format!("{rotate_pages_threshold:?}").into()
821 } else {
822 String::new().into()
823 },
824 if let Some(max_image_pixels) = &self.max_image_pixels {
825 format!("{max_image_pixels:?}").into()
826 } else {
827 String::new().into()
828 },
829 if let Some(color_conversion_strategy) = &self.color_conversion_strategy {
830 format!("{color_conversion_strategy:?}").into()
831 } else {
832 String::new().into()
833 },
834 if let Some(app_title) = &self.app_title {
835 format!("{app_title:?}").into()
836 } else {
837 String::new().into()
838 },
839 if let Some(app_logo) = &self.app_logo {
840 format!("{app_logo:?}").into()
841 } else {
842 String::new().into()
843 },
844 if let Some(barcodes_enabled) = &self.barcodes_enabled {
845 format!("{barcodes_enabled:?}").into()
846 } else {
847 String::new().into()
848 },
849 if let Some(barcode_enable_tiff_support) = &self.barcode_enable_tiff_support {
850 format!("{barcode_enable_tiff_support:?}").into()
851 } else {
852 String::new().into()
853 },
854 if let Some(barcode_string) = &self.barcode_string {
855 format!("{barcode_string:?}").into()
856 } else {
857 String::new().into()
858 },
859 if let Some(barcode_retain_split_pages) = &self.barcode_retain_split_pages {
860 format!("{barcode_retain_split_pages:?}").into()
861 } else {
862 String::new().into()
863 },
864 if let Some(barcode_enable_asn) = &self.barcode_enable_asn {
865 format!("{barcode_enable_asn:?}").into()
866 } else {
867 String::new().into()
868 },
869 if let Some(barcode_asn_prefix) = &self.barcode_asn_prefix {
870 format!("{barcode_asn_prefix:?}").into()
871 } else {
872 String::new().into()
873 },
874 if let Some(barcode_upscale) = &self.barcode_upscale {
875 format!("{barcode_upscale:?}").into()
876 } else {
877 String::new().into()
878 },
879 if let Some(barcode_dpi) = &self.barcode_dpi {
880 format!("{barcode_dpi:?}").into()
881 } else {
882 String::new().into()
883 },
884 if let Some(barcode_max_pages) = &self.barcode_max_pages {
885 format!("{barcode_max_pages:?}").into()
886 } else {
887 String::new().into()
888 },
889 if let Some(barcode_enable_tag) = &self.barcode_enable_tag {
890 format!("{barcode_enable_tag:?}").into()
891 } else {
892 String::new().into()
893 },
894 ]
895 }
896
897 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
898 vec![
899 "id".into(),
900 "user_args".into(),
901 "barcode_tag_mapping".into(),
902 "output_type".into(),
903 "pages".into(),
904 "language".into(),
905 "mode".into(),
906 "skip_archive_file".into(),
907 "image_dpi".into(),
908 "unpaper_clean".into(),
909 "deskew".into(),
910 "rotate_pages".into(),
911 "rotate_pages_threshold".into(),
912 "max_image_pixels".into(),
913 "color_conversion_strategy".into(),
914 "app_title".into(),
915 "app_logo".into(),
916 "barcodes_enabled".into(),
917 "barcode_enable_tiff_support".into(),
918 "barcode_string".into(),
919 "barcode_retain_split_pages".into(),
920 "barcode_enable_asn".into(),
921 "barcode_asn_prefix".into(),
922 "barcode_upscale".into(),
923 "barcode_dpi".into(),
924 "barcode_max_pages".into(),
925 "barcode_enable_tag".into(),
926 ]
927 }
928}
929
930#[derive(
931 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
932)]
933#[allow(non_snake_case)]
934pub struct ApplicationConfigurationRequest {
935 #[serde(default)]
936 pub user_args: Option<serde_json::Value>,
937 #[serde(default)]
938 pub barcode_tag_mapping: Option<serde_json::Value>,
939 #[serde(default, skip_serializing_if = "Option::is_none")]
940 pub output_type: Option<OutputType>,
941 #[serde(default, skip_serializing_if = "Option::is_none")]
942 pub pages: Option<i64>,
943 #[serde(default, skip_serializing_if = "Option::is_none")]
944 pub language: Option<String>,
945 #[serde(default, skip_serializing_if = "Option::is_none")]
946 pub mode: Option<Mode>,
947 #[serde(default, skip_serializing_if = "Option::is_none")]
948 pub skip_archive_file: Option<SkipArchiveFile>,
949 #[serde(default, skip_serializing_if = "Option::is_none")]
950 pub image_dpi: Option<i64>,
951 #[serde(default, skip_serializing_if = "Option::is_none")]
952 pub unpaper_clean: Option<UnpaperClean>,
953 #[serde(default, skip_serializing_if = "Option::is_none")]
954 pub deskew: Option<bool>,
955 #[serde(default, skip_serializing_if = "Option::is_none")]
956 pub rotate_pages: Option<bool>,
957 #[serde(default, skip_serializing_if = "Option::is_none")]
958 pub rotate_pages_threshold: Option<f64>,
959 #[serde(default, skip_serializing_if = "Option::is_none")]
960 pub max_image_pixels: Option<f64>,
961 #[serde(default, skip_serializing_if = "Option::is_none")]
962 pub color_conversion_strategy: Option<ColorConversionStrategy>,
963 #[serde(default, skip_serializing_if = "Option::is_none")]
964 pub app_title: Option<String>,
965 #[serde(default, skip_serializing_if = "Option::is_none")]
966 pub app_logo: Option<bytes::Bytes>,
967 #[serde(default, skip_serializing_if = "Option::is_none")]
968 pub barcodes_enabled: Option<bool>,
969 #[serde(default, skip_serializing_if = "Option::is_none")]
970 pub barcode_enable_tiff_support: Option<bool>,
971 #[serde(default, skip_serializing_if = "Option::is_none")]
972 pub barcode_string: Option<String>,
973 #[serde(default, skip_serializing_if = "Option::is_none")]
974 pub barcode_retain_split_pages: Option<bool>,
975 #[serde(default, skip_serializing_if = "Option::is_none")]
976 pub barcode_enable_asn: Option<bool>,
977 #[serde(default, skip_serializing_if = "Option::is_none")]
978 pub barcode_asn_prefix: Option<String>,
979 #[serde(default, skip_serializing_if = "Option::is_none")]
980 pub barcode_upscale: Option<f64>,
981 #[serde(default, skip_serializing_if = "Option::is_none")]
982 pub barcode_dpi: Option<i64>,
983 #[serde(default, skip_serializing_if = "Option::is_none")]
984 pub barcode_max_pages: Option<i64>,
985 #[serde(default, skip_serializing_if = "Option::is_none")]
986 pub barcode_enable_tag: Option<bool>,
987}
988
989impl std::fmt::Display for ApplicationConfigurationRequest {
990 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
991 write!(
992 f,
993 "{}",
994 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
995 )
996 }
997}
998
999#[cfg(feature = "tabled")]
1000impl tabled::Tabled for ApplicationConfigurationRequest {
1001 const LENGTH: usize = 26;
1002 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1003 vec![
1004 format!("{:?}", self.user_args).into(),
1005 format!("{:?}", self.barcode_tag_mapping).into(),
1006 if let Some(output_type) = &self.output_type {
1007 format!("{output_type:?}").into()
1008 } else {
1009 String::new().into()
1010 },
1011 if let Some(pages) = &self.pages {
1012 format!("{pages:?}").into()
1013 } else {
1014 String::new().into()
1015 },
1016 if let Some(language) = &self.language {
1017 format!("{language:?}").into()
1018 } else {
1019 String::new().into()
1020 },
1021 if let Some(mode) = &self.mode {
1022 format!("{mode:?}").into()
1023 } else {
1024 String::new().into()
1025 },
1026 if let Some(skip_archive_file) = &self.skip_archive_file {
1027 format!("{skip_archive_file:?}").into()
1028 } else {
1029 String::new().into()
1030 },
1031 if let Some(image_dpi) = &self.image_dpi {
1032 format!("{image_dpi:?}").into()
1033 } else {
1034 String::new().into()
1035 },
1036 if let Some(unpaper_clean) = &self.unpaper_clean {
1037 format!("{unpaper_clean:?}").into()
1038 } else {
1039 String::new().into()
1040 },
1041 if let Some(deskew) = &self.deskew {
1042 format!("{deskew:?}").into()
1043 } else {
1044 String::new().into()
1045 },
1046 if let Some(rotate_pages) = &self.rotate_pages {
1047 format!("{rotate_pages:?}").into()
1048 } else {
1049 String::new().into()
1050 },
1051 if let Some(rotate_pages_threshold) = &self.rotate_pages_threshold {
1052 format!("{rotate_pages_threshold:?}").into()
1053 } else {
1054 String::new().into()
1055 },
1056 if let Some(max_image_pixels) = &self.max_image_pixels {
1057 format!("{max_image_pixels:?}").into()
1058 } else {
1059 String::new().into()
1060 },
1061 if let Some(color_conversion_strategy) = &self.color_conversion_strategy {
1062 format!("{color_conversion_strategy:?}").into()
1063 } else {
1064 String::new().into()
1065 },
1066 if let Some(app_title) = &self.app_title {
1067 format!("{app_title:?}").into()
1068 } else {
1069 String::new().into()
1070 },
1071 if let Some(app_logo) = &self.app_logo {
1072 format!("{app_logo:?}").into()
1073 } else {
1074 String::new().into()
1075 },
1076 if let Some(barcodes_enabled) = &self.barcodes_enabled {
1077 format!("{barcodes_enabled:?}").into()
1078 } else {
1079 String::new().into()
1080 },
1081 if let Some(barcode_enable_tiff_support) = &self.barcode_enable_tiff_support {
1082 format!("{barcode_enable_tiff_support:?}").into()
1083 } else {
1084 String::new().into()
1085 },
1086 if let Some(barcode_string) = &self.barcode_string {
1087 format!("{barcode_string:?}").into()
1088 } else {
1089 String::new().into()
1090 },
1091 if let Some(barcode_retain_split_pages) = &self.barcode_retain_split_pages {
1092 format!("{barcode_retain_split_pages:?}").into()
1093 } else {
1094 String::new().into()
1095 },
1096 if let Some(barcode_enable_asn) = &self.barcode_enable_asn {
1097 format!("{barcode_enable_asn:?}").into()
1098 } else {
1099 String::new().into()
1100 },
1101 if let Some(barcode_asn_prefix) = &self.barcode_asn_prefix {
1102 format!("{barcode_asn_prefix:?}").into()
1103 } else {
1104 String::new().into()
1105 },
1106 if let Some(barcode_upscale) = &self.barcode_upscale {
1107 format!("{barcode_upscale:?}").into()
1108 } else {
1109 String::new().into()
1110 },
1111 if let Some(barcode_dpi) = &self.barcode_dpi {
1112 format!("{barcode_dpi:?}").into()
1113 } else {
1114 String::new().into()
1115 },
1116 if let Some(barcode_max_pages) = &self.barcode_max_pages {
1117 format!("{barcode_max_pages:?}").into()
1118 } else {
1119 String::new().into()
1120 },
1121 if let Some(barcode_enable_tag) = &self.barcode_enable_tag {
1122 format!("{barcode_enable_tag:?}").into()
1123 } else {
1124 String::new().into()
1125 },
1126 ]
1127 }
1128
1129 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1130 vec![
1131 "user_args".into(),
1132 "barcode_tag_mapping".into(),
1133 "output_type".into(),
1134 "pages".into(),
1135 "language".into(),
1136 "mode".into(),
1137 "skip_archive_file".into(),
1138 "image_dpi".into(),
1139 "unpaper_clean".into(),
1140 "deskew".into(),
1141 "rotate_pages".into(),
1142 "rotate_pages_threshold".into(),
1143 "max_image_pixels".into(),
1144 "color_conversion_strategy".into(),
1145 "app_title".into(),
1146 "app_logo".into(),
1147 "barcodes_enabled".into(),
1148 "barcode_enable_tiff_support".into(),
1149 "barcode_string".into(),
1150 "barcode_retain_split_pages".into(),
1151 "barcode_enable_asn".into(),
1152 "barcode_asn_prefix".into(),
1153 "barcode_upscale".into(),
1154 "barcode_dpi".into(),
1155 "barcode_max_pages".into(),
1156 "barcode_enable_tag".into(),
1157 ]
1158 }
1159}
1160
1161#[derive(
1162 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1163)]
1164#[allow(non_snake_case)]
1165pub struct BasicUser {
1166 pub id: i64,
1167 #[doc = "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."]
1168 pub username: String,
1169 #[serde(default, skip_serializing_if = "Option::is_none")]
1170 pub first_name: Option<String>,
1171 #[serde(default, skip_serializing_if = "Option::is_none")]
1172 pub last_name: Option<String>,
1173}
1174
1175impl std::fmt::Display for BasicUser {
1176 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1177 write!(
1178 f,
1179 "{}",
1180 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1181 )
1182 }
1183}
1184
1185#[cfg(feature = "tabled")]
1186impl tabled::Tabled for BasicUser {
1187 const LENGTH: usize = 4;
1188 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1189 vec![
1190 format!("{:?}", self.id).into(),
1191 self.username.clone().into(),
1192 if let Some(first_name) = &self.first_name {
1193 format!("{first_name:?}").into()
1194 } else {
1195 String::new().into()
1196 },
1197 if let Some(last_name) = &self.last_name {
1198 format!("{last_name:?}").into()
1199 } else {
1200 String::new().into()
1201 },
1202 ]
1203 }
1204
1205 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1206 vec![
1207 "id".into(),
1208 "username".into(),
1209 "first_name".into(),
1210 "last_name".into(),
1211 ]
1212 }
1213}
1214
1215#[derive(
1216 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1217)]
1218#[allow(non_snake_case)]
1219pub struct BasicUserRequest {
1220 #[doc = "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."]
1221 pub username: String,
1222 #[serde(default, skip_serializing_if = "Option::is_none")]
1223 pub first_name: Option<String>,
1224 #[serde(default, skip_serializing_if = "Option::is_none")]
1225 pub last_name: Option<String>,
1226}
1227
1228impl std::fmt::Display for BasicUserRequest {
1229 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1230 write!(
1231 f,
1232 "{}",
1233 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1234 )
1235 }
1236}
1237
1238#[cfg(feature = "tabled")]
1239impl tabled::Tabled for BasicUserRequest {
1240 const LENGTH: usize = 3;
1241 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1242 vec![
1243 self.username.clone().into(),
1244 if let Some(first_name) = &self.first_name {
1245 format!("{first_name:?}").into()
1246 } else {
1247 String::new().into()
1248 },
1249 if let Some(last_name) = &self.last_name {
1250 format!("{last_name:?}").into()
1251 } else {
1252 String::new().into()
1253 },
1254 ]
1255 }
1256
1257 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1258 vec!["username".into(), "first_name".into(), "last_name".into()]
1259 }
1260}
1261
1262#[derive(
1263 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1264)]
1265#[allow(non_snake_case)]
1266pub struct BulkDownload {
1267 #[serde(default, skip_serializing_if = "Option::is_none")]
1268 pub content: Option<ContentEnum>,
1269 #[serde(default, skip_serializing_if = "Option::is_none")]
1270 pub compression: Option<CompressionEnum>,
1271 #[serde(default)]
1272 pub follow_formatting: bool,
1273}
1274
1275impl std::fmt::Display for BulkDownload {
1276 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1277 write!(
1278 f,
1279 "{}",
1280 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1281 )
1282 }
1283}
1284
1285#[cfg(feature = "tabled")]
1286impl tabled::Tabled for BulkDownload {
1287 const LENGTH: usize = 3;
1288 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1289 vec![
1290 if let Some(content) = &self.content {
1291 format!("{content:?}").into()
1292 } else {
1293 String::new().into()
1294 },
1295 if let Some(compression) = &self.compression {
1296 format!("{compression:?}").into()
1297 } else {
1298 String::new().into()
1299 },
1300 format!("{:?}", self.follow_formatting).into(),
1301 ]
1302 }
1303
1304 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1305 vec![
1306 "content".into(),
1307 "compression".into(),
1308 "follow_formatting".into(),
1309 ]
1310 }
1311}
1312
1313#[derive(
1314 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1315)]
1316#[allow(non_snake_case)]
1317pub struct BulkDownloadRequest {
1318 pub documents: Vec<i64>,
1319 #[serde(default, skip_serializing_if = "Option::is_none")]
1320 pub content: Option<ContentEnum>,
1321 #[serde(default, skip_serializing_if = "Option::is_none")]
1322 pub compression: Option<CompressionEnum>,
1323 #[serde(default)]
1324 pub follow_formatting: bool,
1325}
1326
1327impl std::fmt::Display for BulkDownloadRequest {
1328 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1329 write!(
1330 f,
1331 "{}",
1332 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1333 )
1334 }
1335}
1336
1337#[cfg(feature = "tabled")]
1338impl tabled::Tabled for BulkDownloadRequest {
1339 const LENGTH: usize = 4;
1340 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1341 vec![
1342 format!("{:?}", self.documents).into(),
1343 if let Some(content) = &self.content {
1344 format!("{content:?}").into()
1345 } else {
1346 String::new().into()
1347 },
1348 if let Some(compression) = &self.compression {
1349 format!("{compression:?}").into()
1350 } else {
1351 String::new().into()
1352 },
1353 format!("{:?}", self.follow_formatting).into(),
1354 ]
1355 }
1356
1357 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1358 vec![
1359 "documents".into(),
1360 "content".into(),
1361 "compression".into(),
1362 "follow_formatting".into(),
1363 ]
1364 }
1365}
1366
1367#[derive(
1368 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1369)]
1370#[allow(non_snake_case)]
1371pub struct BulkEditDocumentsResult {
1372 pub result: String,
1373}
1374
1375impl std::fmt::Display for BulkEditDocumentsResult {
1376 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1377 write!(
1378 f,
1379 "{}",
1380 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1381 )
1382 }
1383}
1384
1385#[cfg(feature = "tabled")]
1386impl tabled::Tabled for BulkEditDocumentsResult {
1387 const LENGTH: usize = 1;
1388 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1389 vec![self.result.clone().into()]
1390 }
1391
1392 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1393 vec!["result".into()]
1394 }
1395}
1396
1397#[derive(
1398 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1399)]
1400#[allow(non_snake_case)]
1401pub struct BulkEditObjectsRequest {
1402 pub objects: Vec<i64>,
1403 pub object_type: ObjectTypeEnum,
1404 pub operation: OperationEnum,
1405 #[serde(default, skip_serializing_if = "Option::is_none")]
1406 pub owner: Option<i64>,
1407 #[serde(default, skip_serializing_if = "Option::is_none")]
1408 pub permissions: Option<std::collections::HashMap<String, serde_json::Value>>,
1409 #[serde(default)]
1410 pub merge: bool,
1411}
1412
1413impl std::fmt::Display for BulkEditObjectsRequest {
1414 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1415 write!(
1416 f,
1417 "{}",
1418 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1419 )
1420 }
1421}
1422
1423#[cfg(feature = "tabled")]
1424impl tabled::Tabled for BulkEditObjectsRequest {
1425 const LENGTH: usize = 6;
1426 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1427 vec![
1428 format!("{:?}", self.objects).into(),
1429 format!("{:?}", self.object_type).into(),
1430 format!("{:?}", self.operation).into(),
1431 if let Some(owner) = &self.owner {
1432 format!("{owner:?}").into()
1433 } else {
1434 String::new().into()
1435 },
1436 if let Some(permissions) = &self.permissions {
1437 format!("{permissions:?}").into()
1438 } else {
1439 String::new().into()
1440 },
1441 format!("{:?}", self.merge).into(),
1442 ]
1443 }
1444
1445 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1446 vec![
1447 "objects".into(),
1448 "object_type".into(),
1449 "operation".into(),
1450 "owner".into(),
1451 "permissions".into(),
1452 "merge".into(),
1453 ]
1454 }
1455}
1456
1457#[derive(
1458 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1459)]
1460#[allow(non_snake_case)]
1461pub struct BulkEditRequest {
1462 pub documents: Vec<i64>,
1463 pub method: MethodEnum,
1464 #[serde(default, skip_serializing_if = "Option::is_none")]
1465 pub parameters: Option<std::collections::HashMap<String, serde_json::Value>>,
1466}
1467
1468impl std::fmt::Display for BulkEditRequest {
1469 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1470 write!(
1471 f,
1472 "{}",
1473 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1474 )
1475 }
1476}
1477
1478#[cfg(feature = "tabled")]
1479impl tabled::Tabled for BulkEditRequest {
1480 const LENGTH: usize = 3;
1481 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1482 vec![
1483 format!("{:?}", self.documents).into(),
1484 format!("{:?}", self.method).into(),
1485 if let Some(parameters) = &self.parameters {
1486 format!("{parameters:?}").into()
1487 } else {
1488 String::new().into()
1489 },
1490 ]
1491 }
1492
1493 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1494 vec!["documents".into(), "method".into(), "parameters".into()]
1495 }
1496}
1497
1498#[derive(
1499 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1500)]
1501#[allow(non_snake_case)]
1502pub struct BulkEditResult {
1503 pub result: String,
1504}
1505
1506impl std::fmt::Display for BulkEditResult {
1507 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1508 write!(
1509 f,
1510 "{}",
1511 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1512 )
1513 }
1514}
1515
1516#[cfg(feature = "tabled")]
1517impl tabled::Tabled for BulkEditResult {
1518 const LENGTH: usize = 1;
1519 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1520 vec![self.result.clone().into()]
1521 }
1522
1523 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1524 vec!["result".into()]
1525 }
1526}
1527
1528#[derive(
1529 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1530)]
1531#[allow(non_snake_case)]
1532pub struct Classifier {
1533 pub status: String,
1534 pub error: String,
1535 pub last_trained: chrono::DateTime<chrono::Utc>,
1536}
1537
1538impl std::fmt::Display for Classifier {
1539 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1540 write!(
1541 f,
1542 "{}",
1543 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1544 )
1545 }
1546}
1547
1548#[cfg(feature = "tabled")]
1549impl tabled::Tabled for Classifier {
1550 const LENGTH: usize = 3;
1551 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1552 vec![
1553 self.status.clone().into(),
1554 self.error.clone().into(),
1555 format!("{:?}", self.last_trained).into(),
1556 ]
1557 }
1558
1559 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1560 vec!["status".into(), "error".into(), "last_trained".into()]
1561 }
1562}
1563
1564#[doc = "* `LeaveColorUnchanged` - LeaveColorUnchanged\n* `RGB` - RGB\n* `UseDeviceIndependentColor` - UseDeviceIndependentColor\n* `Gray` - Gray\n* `CMYK` - CMYK"]
1565#[derive(
1566 serde :: Serialize,
1567 serde :: Deserialize,
1568 PartialEq,
1569 Hash,
1570 Debug,
1571 Clone,
1572 schemars :: JsonSchema,
1573 parse_display :: FromStr,
1574 parse_display :: Display,
1575)]
1576#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1577#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1578pub enum ColorConversionStrategyEnum {
1579 LeaveColorUnchanged,
1580 #[serde(rename = "RGB")]
1581 #[display("RGB")]
1582 Rgb,
1583 UseDeviceIndependentColor,
1584 Gray,
1585 #[serde(rename = "CMYK")]
1586 #[display("CMYK")]
1587 Cmyk,
1588 #[serde(rename = "")]
1589 #[display("")]
1590 Empty,
1591}
1592
1593#[doc = "* `none` - none\n* `deflated` - deflated\n* `bzip2` - bzip2\n* `lzma` - lzma"]
1594#[derive(
1595 serde :: Serialize,
1596 serde :: Deserialize,
1597 PartialEq,
1598 Hash,
1599 Debug,
1600 Clone,
1601 schemars :: JsonSchema,
1602 parse_display :: FromStr,
1603 parse_display :: Display,
1604)]
1605#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1606#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1607pub enum CompressionEnum {
1608 #[serde(rename = "none")]
1609 #[display("none")]
1610 None,
1611 #[serde(rename = "deflated")]
1612 #[display("deflated")]
1613 Deflated,
1614 #[serde(rename = "bzip2")]
1615 #[display("bzip2")]
1616 Bzip2,
1617 #[serde(rename = "lzma")]
1618 #[display("lzma")]
1619 Lzma,
1620}
1621
1622#[doc = "* `archive` - archive\n* `originals` - originals\n* `both` - both"]
1623#[derive(
1624 serde :: Serialize,
1625 serde :: Deserialize,
1626 PartialEq,
1627 Hash,
1628 Debug,
1629 Clone,
1630 schemars :: JsonSchema,
1631 parse_display :: FromStr,
1632 parse_display :: Display,
1633)]
1634#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1635#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1636pub enum ContentEnum {
1637 #[serde(rename = "archive")]
1638 #[display("archive")]
1639 Archive,
1640 #[serde(rename = "originals")]
1641 #[display("originals")]
1642 Originals,
1643 #[serde(rename = "both")]
1644 #[display("both")]
1645 Both,
1646}
1647
1648#[derive(
1649 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1650)]
1651#[allow(non_snake_case)]
1652pub struct View {
1653 #[serde(default, skip_serializing_if = "Option::is_none")]
1654 pub users: Option<Vec<i64>>,
1655 #[serde(default, skip_serializing_if = "Option::is_none")]
1656 pub groups: Option<Vec<i64>>,
1657}
1658
1659impl std::fmt::Display for View {
1660 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1661 write!(
1662 f,
1663 "{}",
1664 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1665 )
1666 }
1667}
1668
1669#[cfg(feature = "tabled")]
1670impl tabled::Tabled for View {
1671 const LENGTH: usize = 2;
1672 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1673 vec![
1674 if let Some(users) = &self.users {
1675 format!("{users:?}").into()
1676 } else {
1677 String::new().into()
1678 },
1679 if let Some(groups) = &self.groups {
1680 format!("{groups:?}").into()
1681 } else {
1682 String::new().into()
1683 },
1684 ]
1685 }
1686
1687 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1688 vec!["users".into(), "groups".into()]
1689 }
1690}
1691
1692#[derive(
1693 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1694)]
1695#[allow(non_snake_case)]
1696pub struct Change {
1697 #[serde(default, skip_serializing_if = "Option::is_none")]
1698 pub users: Option<Vec<i64>>,
1699 #[serde(default, skip_serializing_if = "Option::is_none")]
1700 pub groups: Option<Vec<i64>>,
1701}
1702
1703impl std::fmt::Display for Change {
1704 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1705 write!(
1706 f,
1707 "{}",
1708 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1709 )
1710 }
1711}
1712
1713#[cfg(feature = "tabled")]
1714impl tabled::Tabled for Change {
1715 const LENGTH: usize = 2;
1716 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1717 vec![
1718 if let Some(users) = &self.users {
1719 format!("{users:?}").into()
1720 } else {
1721 String::new().into()
1722 },
1723 if let Some(groups) = &self.groups {
1724 format!("{groups:?}").into()
1725 } else {
1726 String::new().into()
1727 },
1728 ]
1729 }
1730
1731 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1732 vec!["users".into(), "groups".into()]
1733 }
1734}
1735
1736#[derive(
1737 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1738)]
1739#[allow(non_snake_case)]
1740pub struct Permissions {
1741 #[serde(default, skip_serializing_if = "Option::is_none")]
1742 pub view: Option<View>,
1743 #[serde(default, skip_serializing_if = "Option::is_none")]
1744 pub change: Option<Change>,
1745}
1746
1747impl std::fmt::Display for Permissions {
1748 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1749 write!(
1750 f,
1751 "{}",
1752 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1753 )
1754 }
1755}
1756
1757#[cfg(feature = "tabled")]
1758impl tabled::Tabled for Permissions {
1759 const LENGTH: usize = 2;
1760 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1761 vec![
1762 if let Some(view) = &self.view {
1763 format!("{view:?}").into()
1764 } else {
1765 String::new().into()
1766 },
1767 if let Some(change) = &self.change {
1768 format!("{change:?}").into()
1769 } else {
1770 String::new().into()
1771 },
1772 ]
1773 }
1774
1775 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1776 vec!["view".into(), "change".into()]
1777 }
1778}
1779
1780#[derive(
1781 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1782)]
1783#[allow(non_snake_case)]
1784pub struct Correspondent {
1785 pub id: i64,
1786 pub slug: String,
1787 pub name: String,
1788 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
1789 pub match_: Option<String>,
1790 #[serde(default, skip_serializing_if = "Option::is_none")]
1791 pub matching_algorithm: Option<i64>,
1792 #[serde(default, skip_serializing_if = "Option::is_none")]
1793 pub is_insensitive: Option<bool>,
1794 pub document_count: i64,
1795 #[serde(default, skip_serializing_if = "Option::is_none")]
1796 pub last_correspondence: Option<chrono::NaiveDate>,
1797 #[serde(default, skip_serializing_if = "Option::is_none")]
1798 pub owner: Option<i64>,
1799 #[serde(default, skip_serializing_if = "Option::is_none")]
1800 pub permissions: Option<Permissions>,
1801 pub user_can_change: bool,
1802}
1803
1804impl std::fmt::Display for Correspondent {
1805 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1806 write!(
1807 f,
1808 "{}",
1809 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1810 )
1811 }
1812}
1813
1814#[cfg(feature = "tabled")]
1815impl tabled::Tabled for Correspondent {
1816 const LENGTH: usize = 11;
1817 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1818 vec![
1819 format!("{:?}", self.id).into(),
1820 self.slug.clone().into(),
1821 self.name.clone().into(),
1822 if let Some(match_) = &self.match_ {
1823 format!("{match_:?}").into()
1824 } else {
1825 String::new().into()
1826 },
1827 if let Some(matching_algorithm) = &self.matching_algorithm {
1828 format!("{matching_algorithm:?}").into()
1829 } else {
1830 String::new().into()
1831 },
1832 if let Some(is_insensitive) = &self.is_insensitive {
1833 format!("{is_insensitive:?}").into()
1834 } else {
1835 String::new().into()
1836 },
1837 format!("{:?}", self.document_count).into(),
1838 if let Some(last_correspondence) = &self.last_correspondence {
1839 format!("{last_correspondence:?}").into()
1840 } else {
1841 String::new().into()
1842 },
1843 if let Some(owner) = &self.owner {
1844 format!("{owner:?}").into()
1845 } else {
1846 String::new().into()
1847 },
1848 if let Some(permissions) = &self.permissions {
1849 format!("{permissions:?}").into()
1850 } else {
1851 String::new().into()
1852 },
1853 format!("{:?}", self.user_can_change).into(),
1854 ]
1855 }
1856
1857 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1858 vec![
1859 "id".into(),
1860 "slug".into(),
1861 "name".into(),
1862 "match_".into(),
1863 "matching_algorithm".into(),
1864 "is_insensitive".into(),
1865 "document_count".into(),
1866 "last_correspondence".into(),
1867 "owner".into(),
1868 "permissions".into(),
1869 "user_can_change".into(),
1870 ]
1871 }
1872}
1873
1874#[derive(
1875 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1876)]
1877#[allow(non_snake_case)]
1878pub struct CorrespondentCounts {
1879 pub id: i64,
1880 pub document_count: i64,
1881}
1882
1883impl std::fmt::Display for CorrespondentCounts {
1884 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1885 write!(
1886 f,
1887 "{}",
1888 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1889 )
1890 }
1891}
1892
1893#[cfg(feature = "tabled")]
1894impl tabled::Tabled for CorrespondentCounts {
1895 const LENGTH: usize = 2;
1896 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1897 vec![
1898 format!("{:?}", self.id).into(),
1899 format!("{:?}", self.document_count).into(),
1900 ]
1901 }
1902
1903 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1904 vec!["id".into(), "document_count".into()]
1905 }
1906}
1907
1908#[derive(
1909 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1910)]
1911#[allow(non_snake_case)]
1912pub struct SetPermissions {
1913 #[serde(default, skip_serializing_if = "Option::is_none")]
1914 pub view: Option<View>,
1915 #[serde(default, skip_serializing_if = "Option::is_none")]
1916 pub change: Option<Change>,
1917}
1918
1919impl std::fmt::Display for SetPermissions {
1920 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1921 write!(
1922 f,
1923 "{}",
1924 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1925 )
1926 }
1927}
1928
1929#[cfg(feature = "tabled")]
1930impl tabled::Tabled for SetPermissions {
1931 const LENGTH: usize = 2;
1932 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1933 vec![
1934 if let Some(view) = &self.view {
1935 format!("{view:?}").into()
1936 } else {
1937 String::new().into()
1938 },
1939 if let Some(change) = &self.change {
1940 format!("{change:?}").into()
1941 } else {
1942 String::new().into()
1943 },
1944 ]
1945 }
1946
1947 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1948 vec!["view".into(), "change".into()]
1949 }
1950}
1951
1952#[derive(
1953 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1954)]
1955#[allow(non_snake_case)]
1956pub struct CorrespondentRequest {
1957 pub name: String,
1958 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
1959 pub match_: Option<String>,
1960 #[serde(default, skip_serializing_if = "Option::is_none")]
1961 pub matching_algorithm: Option<i64>,
1962 #[serde(default, skip_serializing_if = "Option::is_none")]
1963 pub is_insensitive: Option<bool>,
1964 #[serde(default, skip_serializing_if = "Option::is_none")]
1965 pub owner: Option<i64>,
1966 #[serde(default, skip_serializing_if = "Option::is_none")]
1967 pub set_permissions: Option<SetPermissions>,
1968}
1969
1970impl std::fmt::Display for CorrespondentRequest {
1971 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1972 write!(
1973 f,
1974 "{}",
1975 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1976 )
1977 }
1978}
1979
1980#[cfg(feature = "tabled")]
1981impl tabled::Tabled for CorrespondentRequest {
1982 const LENGTH: usize = 6;
1983 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1984 vec![
1985 self.name.clone().into(),
1986 if let Some(match_) = &self.match_ {
1987 format!("{match_:?}").into()
1988 } else {
1989 String::new().into()
1990 },
1991 if let Some(matching_algorithm) = &self.matching_algorithm {
1992 format!("{matching_algorithm:?}").into()
1993 } else {
1994 String::new().into()
1995 },
1996 if let Some(is_insensitive) = &self.is_insensitive {
1997 format!("{is_insensitive:?}").into()
1998 } else {
1999 String::new().into()
2000 },
2001 if let Some(owner) = &self.owner {
2002 format!("{owner:?}").into()
2003 } else {
2004 String::new().into()
2005 },
2006 if let Some(set_permissions) = &self.set_permissions {
2007 format!("{set_permissions:?}").into()
2008 } else {
2009 String::new().into()
2010 },
2011 ]
2012 }
2013
2014 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2015 vec![
2016 "name".into(),
2017 "match_".into(),
2018 "matching_algorithm".into(),
2019 "is_insensitive".into(),
2020 "owner".into(),
2021 "set_permissions".into(),
2022 ]
2023 }
2024}
2025
2026#[derive(
2027 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2028)]
2029#[allow(non_snake_case)]
2030pub struct CustomField {
2031 pub id: i64,
2032 pub name: String,
2033 #[doc = "* `string` - string\n* `url` - url\n* `date` - date\n* `boolean` - boolean\n* `integer` - integer\n* `float` - float\n* `monetary` - monetary\n* `documentlink` - documentlink\n* `select` - select"]
2034 pub data_type: DataTypeEnum,
2035 #[doc = "Extra data for the custom field, such as select options"]
2036 #[serde(default, skip_serializing_if = "Option::is_none")]
2037 pub extra_data: Option<serde_json::Value>,
2038 pub document_count: i64,
2039}
2040
2041impl std::fmt::Display for CustomField {
2042 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2043 write!(
2044 f,
2045 "{}",
2046 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2047 )
2048 }
2049}
2050
2051#[cfg(feature = "tabled")]
2052impl tabled::Tabled for CustomField {
2053 const LENGTH: usize = 5;
2054 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2055 vec![
2056 format!("{:?}", self.id).into(),
2057 self.name.clone().into(),
2058 format!("{:?}", self.data_type).into(),
2059 if let Some(extra_data) = &self.extra_data {
2060 format!("{extra_data:?}").into()
2061 } else {
2062 String::new().into()
2063 },
2064 format!("{:?}", self.document_count).into(),
2065 ]
2066 }
2067
2068 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2069 vec![
2070 "id".into(),
2071 "name".into(),
2072 "data_type".into(),
2073 "extra_data".into(),
2074 "document_count".into(),
2075 ]
2076 }
2077}
2078
2079#[derive(
2080 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2081)]
2082#[allow(non_snake_case)]
2083pub struct CustomFieldCounts {
2084 pub id: i64,
2085 pub document_count: i64,
2086}
2087
2088impl std::fmt::Display for CustomFieldCounts {
2089 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2090 write!(
2091 f,
2092 "{}",
2093 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2094 )
2095 }
2096}
2097
2098#[cfg(feature = "tabled")]
2099impl tabled::Tabled for CustomFieldCounts {
2100 const LENGTH: usize = 2;
2101 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2102 vec![
2103 format!("{:?}", self.id).into(),
2104 format!("{:?}", self.document_count).into(),
2105 ]
2106 }
2107
2108 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2109 vec!["id".into(), "document_count".into()]
2110 }
2111}
2112
2113#[derive(
2114 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2115)]
2116#[allow(non_snake_case)]
2117pub struct CustomFieldInstance {
2118 #[doc = "Given the *incoming* primitive data, return the value for this field\nthat should be validated and transformed to a native value."]
2119 #[serde(default, skip_serializing_if = "Option::is_none")]
2120 pub value: Option<serde_json::Value>,
2121 pub field: i64,
2122}
2123
2124impl std::fmt::Display for CustomFieldInstance {
2125 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2126 write!(
2127 f,
2128 "{}",
2129 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2130 )
2131 }
2132}
2133
2134#[cfg(feature = "tabled")]
2135impl tabled::Tabled for CustomFieldInstance {
2136 const LENGTH: usize = 2;
2137 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2138 vec![
2139 if let Some(value) = &self.value {
2140 format!("{value:?}").into()
2141 } else {
2142 String::new().into()
2143 },
2144 format!("{:?}", self.field).into(),
2145 ]
2146 }
2147
2148 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2149 vec!["value".into(), "field".into()]
2150 }
2151}
2152
2153#[derive(
2154 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2155)]
2156#[allow(non_snake_case)]
2157pub struct CustomFieldInstanceRequest {
2158 #[doc = "Given the *incoming* primitive data, return the value for this field\nthat should be validated and transformed to a native value."]
2159 #[serde(default)]
2160 pub value: Option<serde_json::Value>,
2161 pub field: i64,
2162}
2163
2164impl std::fmt::Display for CustomFieldInstanceRequest {
2165 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2166 write!(
2167 f,
2168 "{}",
2169 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2170 )
2171 }
2172}
2173
2174#[cfg(feature = "tabled")]
2175impl tabled::Tabled for CustomFieldInstanceRequest {
2176 const LENGTH: usize = 2;
2177 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2178 vec![
2179 format!("{:?}", self.value).into(),
2180 format!("{:?}", self.field).into(),
2181 ]
2182 }
2183
2184 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2185 vec!["value".into(), "field".into()]
2186 }
2187}
2188
2189#[derive(
2190 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2191)]
2192#[allow(non_snake_case)]
2193pub struct CustomFieldRequest {
2194 pub name: String,
2195 #[doc = "* `string` - string\n* `url` - url\n* `date` - date\n* `boolean` - boolean\n* `integer` - integer\n* `float` - float\n* `monetary` - monetary\n* `documentlink` - documentlink\n* `select` - select"]
2196 pub data_type: DataTypeEnum,
2197 #[doc = "Extra data for the custom field, such as select options"]
2198 #[serde(default, skip_serializing_if = "Option::is_none")]
2199 pub extra_data: Option<serde_json::Value>,
2200}
2201
2202impl std::fmt::Display for CustomFieldRequest {
2203 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2204 write!(
2205 f,
2206 "{}",
2207 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2208 )
2209 }
2210}
2211
2212#[cfg(feature = "tabled")]
2213impl tabled::Tabled for CustomFieldRequest {
2214 const LENGTH: usize = 3;
2215 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2216 vec![
2217 self.name.clone().into(),
2218 format!("{:?}", self.data_type).into(),
2219 if let Some(extra_data) = &self.extra_data {
2220 format!("{extra_data:?}").into()
2221 } else {
2222 String::new().into()
2223 },
2224 ]
2225 }
2226
2227 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2228 vec!["name".into(), "data_type".into(), "extra_data".into()]
2229 }
2230}
2231
2232#[doc = "* `string` - string\n* `url` - url\n* `date` - date\n* `boolean` - boolean\n* `integer` - integer\n* `float` - float\n* `monetary` - monetary\n* `documentlink` - documentlink\n* `select` - select"]
2233#[derive(
2234 serde :: Serialize,
2235 serde :: Deserialize,
2236 PartialEq,
2237 Hash,
2238 Debug,
2239 Clone,
2240 schemars :: JsonSchema,
2241 parse_display :: FromStr,
2242 parse_display :: Display,
2243)]
2244#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
2245#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
2246pub enum DataTypeEnum {
2247 #[serde(rename = "string")]
2248 #[display("string")]
2249 String,
2250 #[serde(rename = "url")]
2251 #[display("url")]
2252 Url,
2253 #[serde(rename = "date")]
2254 #[display("date")]
2255 Date,
2256 #[serde(rename = "boolean")]
2257 #[display("boolean")]
2258 Boolean,
2259 #[serde(rename = "integer")]
2260 #[display("integer")]
2261 Integer,
2262 #[serde(rename = "float")]
2263 #[display("float")]
2264 Float,
2265 #[serde(rename = "monetary")]
2266 #[display("monetary")]
2267 Monetary,
2268 #[serde(rename = "documentlink")]
2269 #[display("documentlink")]
2270 Documentlink,
2271 #[serde(rename = "select")]
2272 #[display("select")]
2273 Select,
2274}
2275
2276#[derive(
2277 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2278)]
2279#[allow(non_snake_case)]
2280pub struct Database {
2281 #[serde(rename = "type")]
2282 pub type_: String,
2283 pub url: String,
2284 pub status: String,
2285 pub error: String,
2286 pub migration_status: MigrationStatus,
2287}
2288
2289impl std::fmt::Display for Database {
2290 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2291 write!(
2292 f,
2293 "{}",
2294 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2295 )
2296 }
2297}
2298
2299#[cfg(feature = "tabled")]
2300impl tabled::Tabled for Database {
2301 const LENGTH: usize = 5;
2302 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2303 vec![
2304 self.type_.clone().into(),
2305 self.url.clone().into(),
2306 self.status.clone().into(),
2307 self.error.clone().into(),
2308 format!("{:?}", self.migration_status).into(),
2309 ]
2310 }
2311
2312 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2313 vec![
2314 "type_".into(),
2315 "url".into(),
2316 "status".into(),
2317 "error".into(),
2318 "migration_status".into(),
2319 ]
2320 }
2321}
2322
2323#[doc = "* `table` - Table\n* `smallCards` - Small Cards\n* `largeCards` - Large Cards"]
2324#[derive(
2325 serde :: Serialize,
2326 serde :: Deserialize,
2327 PartialEq,
2328 Hash,
2329 Debug,
2330 Clone,
2331 schemars :: JsonSchema,
2332 parse_display :: FromStr,
2333 parse_display :: Display,
2334)]
2335#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
2336#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
2337pub enum DisplayModeEnum {
2338 #[serde(rename = "table")]
2339 #[display("table")]
2340 Table,
2341 #[serde(rename = "smallCards")]
2342 #[display("smallCards")]
2343 SmallCards,
2344 #[serde(rename = "largeCards")]
2345 #[display("largeCards")]
2346 LargeCards,
2347 #[serde(rename = "")]
2348 #[display("")]
2349 Empty,
2350}
2351
2352#[derive(
2353 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2354)]
2355#[allow(non_snake_case)]
2356pub struct DocumentPermissions {
2357 #[serde(default, skip_serializing_if = "Option::is_none")]
2358 pub view: Option<View>,
2359 #[serde(default, skip_serializing_if = "Option::is_none")]
2360 pub change: Option<Change>,
2361}
2362
2363impl std::fmt::Display for DocumentPermissions {
2364 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2365 write!(
2366 f,
2367 "{}",
2368 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2369 )
2370 }
2371}
2372
2373#[cfg(feature = "tabled")]
2374impl tabled::Tabled for DocumentPermissions {
2375 const LENGTH: usize = 2;
2376 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2377 vec![
2378 if let Some(view) = &self.view {
2379 format!("{view:?}").into()
2380 } else {
2381 String::new().into()
2382 },
2383 if let Some(change) = &self.change {
2384 format!("{change:?}").into()
2385 } else {
2386 String::new().into()
2387 },
2388 ]
2389 }
2390
2391 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2392 vec!["view".into(), "change".into()]
2393 }
2394}
2395
2396#[doc = "Adds update nested feature"]
2397#[derive(
2398 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2399)]
2400#[allow(non_snake_case)]
2401pub struct Document {
2402 pub id: i64,
2403 #[serde(default)]
2404 pub correspondent: Option<i64>,
2405 #[serde(default)]
2406 pub document_type: Option<i64>,
2407 #[serde(default)]
2408 pub storage_path: Option<i64>,
2409 #[serde(default, skip_serializing_if = "Option::is_none")]
2410 pub title: Option<String>,
2411 #[doc = "The raw, text-only data of the document. This field is primarily used for searching."]
2412 #[serde(default, skip_serializing_if = "Option::is_none")]
2413 pub content: Option<String>,
2414 pub tags: Vec<i64>,
2415 #[serde(default, skip_serializing_if = "Option::is_none")]
2416 pub created: Option<chrono::NaiveDate>,
2417 #[serde(default, skip_serializing_if = "Option::is_none")]
2418 #[deprecated]
2419 pub created_date: Option<chrono::NaiveDate>,
2420 pub modified: chrono::DateTime<chrono::Utc>,
2421 pub added: chrono::DateTime<chrono::Utc>,
2422 #[serde(default, skip_serializing_if = "Option::is_none")]
2423 pub deleted_at: Option<chrono::DateTime<chrono::Utc>>,
2424 #[doc = "The position of this document in your physical document archive."]
2425 #[serde(default, skip_serializing_if = "Option::is_none")]
2426 pub archive_serial_number: Option<i64>,
2427 #[serde(default)]
2428 pub original_file_name: Option<String>,
2429 #[serde(default)]
2430 pub archived_file_name: Option<String>,
2431 #[serde(default, skip_serializing_if = "Option::is_none")]
2432 pub owner: Option<i64>,
2433 #[serde(default, skip_serializing_if = "Option::is_none")]
2434 pub permissions: Option<DocumentPermissions>,
2435 #[serde(default)]
2436 pub user_can_change: Option<bool>,
2437 #[serde(default)]
2438 pub is_shared_by_requester: Option<bool>,
2439 pub notes: Vec<Notes>,
2440 #[serde(default, skip_serializing_if = "Option::is_none")]
2441 pub custom_fields: Option<Vec<CustomFieldInstance>>,
2442 #[serde(default)]
2443 pub page_count: Option<i64>,
2444 pub mime_type: String,
2445}
2446
2447impl std::fmt::Display for Document {
2448 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2449 write!(
2450 f,
2451 "{}",
2452 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2453 )
2454 }
2455}
2456
2457#[cfg(feature = "tabled")]
2458impl tabled::Tabled for Document {
2459 const LENGTH: usize = 23;
2460 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2461 vec![
2462 format!("{:?}", self.id).into(),
2463 format!("{:?}", self.correspondent).into(),
2464 format!("{:?}", self.document_type).into(),
2465 format!("{:?}", self.storage_path).into(),
2466 if let Some(title) = &self.title {
2467 format!("{title:?}").into()
2468 } else {
2469 String::new().into()
2470 },
2471 if let Some(content) = &self.content {
2472 format!("{content:?}").into()
2473 } else {
2474 String::new().into()
2475 },
2476 format!("{:?}", self.tags).into(),
2477 if let Some(created) = &self.created {
2478 format!("{created:?}").into()
2479 } else {
2480 String::new().into()
2481 },
2482 if let Some(created_date) = &self.created_date {
2483 format!("{created_date:?}").into()
2484 } else {
2485 String::new().into()
2486 },
2487 format!("{:?}", self.modified).into(),
2488 format!("{:?}", self.added).into(),
2489 if let Some(deleted_at) = &self.deleted_at {
2490 format!("{deleted_at:?}").into()
2491 } else {
2492 String::new().into()
2493 },
2494 if let Some(archive_serial_number) = &self.archive_serial_number {
2495 format!("{archive_serial_number:?}").into()
2496 } else {
2497 String::new().into()
2498 },
2499 format!("{:?}", self.original_file_name).into(),
2500 format!("{:?}", self.archived_file_name).into(),
2501 if let Some(owner) = &self.owner {
2502 format!("{owner:?}").into()
2503 } else {
2504 String::new().into()
2505 },
2506 if let Some(permissions) = &self.permissions {
2507 format!("{permissions:?}").into()
2508 } else {
2509 String::new().into()
2510 },
2511 format!("{:?}", self.user_can_change).into(),
2512 format!("{:?}", self.is_shared_by_requester).into(),
2513 format!("{:?}", self.notes).into(),
2514 if let Some(custom_fields) = &self.custom_fields {
2515 format!("{custom_fields:?}").into()
2516 } else {
2517 String::new().into()
2518 },
2519 format!("{:?}", self.page_count).into(),
2520 self.mime_type.clone().into(),
2521 ]
2522 }
2523
2524 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2525 vec![
2526 "id".into(),
2527 "correspondent".into(),
2528 "document_type".into(),
2529 "storage_path".into(),
2530 "title".into(),
2531 "content".into(),
2532 "tags".into(),
2533 "created".into(),
2534 "created_date".into(),
2535 "modified".into(),
2536 "added".into(),
2537 "deleted_at".into(),
2538 "archive_serial_number".into(),
2539 "original_file_name".into(),
2540 "archived_file_name".into(),
2541 "owner".into(),
2542 "permissions".into(),
2543 "user_can_change".into(),
2544 "is_shared_by_requester".into(),
2545 "notes".into(),
2546 "custom_fields".into(),
2547 "page_count".into(),
2548 "mime_type".into(),
2549 ]
2550 }
2551}
2552
2553#[derive(
2554 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2555)]
2556#[allow(non_snake_case)]
2557pub struct DocumentListRequest {
2558 pub documents: Vec<i64>,
2559}
2560
2561impl std::fmt::Display for DocumentListRequest {
2562 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2563 write!(
2564 f,
2565 "{}",
2566 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2567 )
2568 }
2569}
2570
2571#[cfg(feature = "tabled")]
2572impl tabled::Tabled for DocumentListRequest {
2573 const LENGTH: usize = 1;
2574 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2575 vec![format!("{:?}", self.documents).into()]
2576 }
2577
2578 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2579 vec!["documents".into()]
2580 }
2581}
2582
2583#[doc = "Adds update nested feature"]
2584#[derive(
2585 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2586)]
2587#[allow(non_snake_case)]
2588pub struct DocumentRequest {
2589 #[serde(default)]
2590 pub correspondent: Option<i64>,
2591 #[serde(default)]
2592 pub document_type: Option<i64>,
2593 #[serde(default)]
2594 pub storage_path: Option<i64>,
2595 #[serde(default, skip_serializing_if = "Option::is_none")]
2596 pub title: Option<String>,
2597 #[doc = "The raw, text-only data of the document. This field is primarily used for searching."]
2598 #[serde(default, skip_serializing_if = "Option::is_none")]
2599 pub content: Option<String>,
2600 pub tags: Vec<i64>,
2601 #[serde(default, skip_serializing_if = "Option::is_none")]
2602 pub created: Option<chrono::NaiveDate>,
2603 #[serde(default, skip_serializing_if = "Option::is_none")]
2604 #[deprecated]
2605 pub created_date: Option<chrono::NaiveDate>,
2606 #[serde(default, skip_serializing_if = "Option::is_none")]
2607 pub deleted_at: Option<chrono::DateTime<chrono::Utc>>,
2608 #[doc = "The position of this document in your physical document archive."]
2609 #[serde(default, skip_serializing_if = "Option::is_none")]
2610 pub archive_serial_number: Option<i64>,
2611 #[serde(default, skip_serializing_if = "Option::is_none")]
2612 pub owner: Option<i64>,
2613 #[serde(default, skip_serializing_if = "Option::is_none")]
2614 pub set_permissions: Option<SetPermissions>,
2615 #[serde(default, skip_serializing_if = "Option::is_none")]
2616 pub custom_fields: Option<Vec<CustomFieldInstanceRequest>>,
2617 #[serde(default, skip_serializing_if = "Option::is_none")]
2618 pub remove_inbox_tags: Option<bool>,
2619}
2620
2621impl std::fmt::Display for DocumentRequest {
2622 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2623 write!(
2624 f,
2625 "{}",
2626 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2627 )
2628 }
2629}
2630
2631#[cfg(feature = "tabled")]
2632impl tabled::Tabled for DocumentRequest {
2633 const LENGTH: usize = 14;
2634 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2635 vec![
2636 format!("{:?}", self.correspondent).into(),
2637 format!("{:?}", self.document_type).into(),
2638 format!("{:?}", self.storage_path).into(),
2639 if let Some(title) = &self.title {
2640 format!("{title:?}").into()
2641 } else {
2642 String::new().into()
2643 },
2644 if let Some(content) = &self.content {
2645 format!("{content:?}").into()
2646 } else {
2647 String::new().into()
2648 },
2649 format!("{:?}", self.tags).into(),
2650 if let Some(created) = &self.created {
2651 format!("{created:?}").into()
2652 } else {
2653 String::new().into()
2654 },
2655 if let Some(created_date) = &self.created_date {
2656 format!("{created_date:?}").into()
2657 } else {
2658 String::new().into()
2659 },
2660 if let Some(deleted_at) = &self.deleted_at {
2661 format!("{deleted_at:?}").into()
2662 } else {
2663 String::new().into()
2664 },
2665 if let Some(archive_serial_number) = &self.archive_serial_number {
2666 format!("{archive_serial_number:?}").into()
2667 } else {
2668 String::new().into()
2669 },
2670 if let Some(owner) = &self.owner {
2671 format!("{owner:?}").into()
2672 } else {
2673 String::new().into()
2674 },
2675 if let Some(set_permissions) = &self.set_permissions {
2676 format!("{set_permissions:?}").into()
2677 } else {
2678 String::new().into()
2679 },
2680 if let Some(custom_fields) = &self.custom_fields {
2681 format!("{custom_fields:?}").into()
2682 } else {
2683 String::new().into()
2684 },
2685 if let Some(remove_inbox_tags) = &self.remove_inbox_tags {
2686 format!("{remove_inbox_tags:?}").into()
2687 } else {
2688 String::new().into()
2689 },
2690 ]
2691 }
2692
2693 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2694 vec![
2695 "correspondent".into(),
2696 "document_type".into(),
2697 "storage_path".into(),
2698 "title".into(),
2699 "content".into(),
2700 "tags".into(),
2701 "created".into(),
2702 "created_date".into(),
2703 "deleted_at".into(),
2704 "archive_serial_number".into(),
2705 "owner".into(),
2706 "set_permissions".into(),
2707 "custom_fields".into(),
2708 "remove_inbox_tags".into(),
2709 ]
2710 }
2711}
2712
2713#[derive(
2714 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2715)]
2716#[allow(non_snake_case)]
2717pub struct DocumentTypePermissions {
2718 #[serde(default, skip_serializing_if = "Option::is_none")]
2719 pub view: Option<View>,
2720 #[serde(default, skip_serializing_if = "Option::is_none")]
2721 pub change: Option<Change>,
2722}
2723
2724impl std::fmt::Display for DocumentTypePermissions {
2725 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2726 write!(
2727 f,
2728 "{}",
2729 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2730 )
2731 }
2732}
2733
2734#[cfg(feature = "tabled")]
2735impl tabled::Tabled for DocumentTypePermissions {
2736 const LENGTH: usize = 2;
2737 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2738 vec![
2739 if let Some(view) = &self.view {
2740 format!("{view:?}").into()
2741 } else {
2742 String::new().into()
2743 },
2744 if let Some(change) = &self.change {
2745 format!("{change:?}").into()
2746 } else {
2747 String::new().into()
2748 },
2749 ]
2750 }
2751
2752 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2753 vec!["view".into(), "change".into()]
2754 }
2755}
2756
2757#[derive(
2758 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2759)]
2760#[allow(non_snake_case)]
2761pub struct DocumentType {
2762 pub id: i64,
2763 pub slug: String,
2764 pub name: String,
2765 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
2766 pub match_: Option<String>,
2767 #[serde(default, skip_serializing_if = "Option::is_none")]
2768 pub matching_algorithm: Option<i64>,
2769 #[serde(default, skip_serializing_if = "Option::is_none")]
2770 pub is_insensitive: Option<bool>,
2771 pub document_count: i64,
2772 #[serde(default, skip_serializing_if = "Option::is_none")]
2773 pub owner: Option<i64>,
2774 pub permissions: DocumentTypePermissions,
2775 pub user_can_change: bool,
2776}
2777
2778impl std::fmt::Display for DocumentType {
2779 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2780 write!(
2781 f,
2782 "{}",
2783 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2784 )
2785 }
2786}
2787
2788#[cfg(feature = "tabled")]
2789impl tabled::Tabled for DocumentType {
2790 const LENGTH: usize = 10;
2791 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2792 vec![
2793 format!("{:?}", self.id).into(),
2794 self.slug.clone().into(),
2795 self.name.clone().into(),
2796 if let Some(match_) = &self.match_ {
2797 format!("{match_:?}").into()
2798 } else {
2799 String::new().into()
2800 },
2801 if let Some(matching_algorithm) = &self.matching_algorithm {
2802 format!("{matching_algorithm:?}").into()
2803 } else {
2804 String::new().into()
2805 },
2806 if let Some(is_insensitive) = &self.is_insensitive {
2807 format!("{is_insensitive:?}").into()
2808 } else {
2809 String::new().into()
2810 },
2811 format!("{:?}", self.document_count).into(),
2812 if let Some(owner) = &self.owner {
2813 format!("{owner:?}").into()
2814 } else {
2815 String::new().into()
2816 },
2817 format!("{:?}", self.permissions).into(),
2818 format!("{:?}", self.user_can_change).into(),
2819 ]
2820 }
2821
2822 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2823 vec![
2824 "id".into(),
2825 "slug".into(),
2826 "name".into(),
2827 "match_".into(),
2828 "matching_algorithm".into(),
2829 "is_insensitive".into(),
2830 "document_count".into(),
2831 "owner".into(),
2832 "permissions".into(),
2833 "user_can_change".into(),
2834 ]
2835 }
2836}
2837
2838#[derive(
2839 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2840)]
2841#[allow(non_snake_case)]
2842pub struct DocumentTypeCounts {
2843 pub id: i64,
2844 pub document_count: i64,
2845}
2846
2847impl std::fmt::Display for DocumentTypeCounts {
2848 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2849 write!(
2850 f,
2851 "{}",
2852 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2853 )
2854 }
2855}
2856
2857#[cfg(feature = "tabled")]
2858impl tabled::Tabled for DocumentTypeCounts {
2859 const LENGTH: usize = 2;
2860 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2861 vec![
2862 format!("{:?}", self.id).into(),
2863 format!("{:?}", self.document_count).into(),
2864 ]
2865 }
2866
2867 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2868 vec!["id".into(), "document_count".into()]
2869 }
2870}
2871
2872#[derive(
2873 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2874)]
2875#[allow(non_snake_case)]
2876pub struct DocumentTypeRequest {
2877 pub name: String,
2878 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
2879 pub match_: Option<String>,
2880 #[serde(default, skip_serializing_if = "Option::is_none")]
2881 pub matching_algorithm: Option<i64>,
2882 #[serde(default, skip_serializing_if = "Option::is_none")]
2883 pub is_insensitive: Option<bool>,
2884 #[serde(default, skip_serializing_if = "Option::is_none")]
2885 pub owner: Option<i64>,
2886 #[serde(default, skip_serializing_if = "Option::is_none")]
2887 pub set_permissions: Option<SetPermissions>,
2888}
2889
2890impl std::fmt::Display for DocumentTypeRequest {
2891 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2892 write!(
2893 f,
2894 "{}",
2895 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2896 )
2897 }
2898}
2899
2900#[cfg(feature = "tabled")]
2901impl tabled::Tabled for DocumentTypeRequest {
2902 const LENGTH: usize = 6;
2903 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2904 vec![
2905 self.name.clone().into(),
2906 if let Some(match_) = &self.match_ {
2907 format!("{match_:?}").into()
2908 } else {
2909 String::new().into()
2910 },
2911 if let Some(matching_algorithm) = &self.matching_algorithm {
2912 format!("{matching_algorithm:?}").into()
2913 } else {
2914 String::new().into()
2915 },
2916 if let Some(is_insensitive) = &self.is_insensitive {
2917 format!("{is_insensitive:?}").into()
2918 } else {
2919 String::new().into()
2920 },
2921 if let Some(owner) = &self.owner {
2922 format!("{owner:?}").into()
2923 } else {
2924 String::new().into()
2925 },
2926 if let Some(set_permissions) = &self.set_permissions {
2927 format!("{set_permissions:?}").into()
2928 } else {
2929 String::new().into()
2930 },
2931 ]
2932 }
2933
2934 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2935 vec![
2936 "name".into(),
2937 "match_".into(),
2938 "matching_algorithm".into(),
2939 "is_insensitive".into(),
2940 "owner".into(),
2941 "set_permissions".into(),
2942 ]
2943 }
2944}
2945
2946#[derive(
2947 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2948)]
2949#[allow(non_snake_case)]
2950pub struct EmailRequestRequest {
2951 pub addresses: String,
2952 pub subject: String,
2953 pub message: String,
2954 #[serde(default)]
2955 pub use_archive_version: bool,
2956}
2957
2958impl std::fmt::Display for EmailRequestRequest {
2959 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2960 write!(
2961 f,
2962 "{}",
2963 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2964 )
2965 }
2966}
2967
2968#[cfg(feature = "tabled")]
2969impl tabled::Tabled for EmailRequestRequest {
2970 const LENGTH: usize = 4;
2971 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2972 vec![
2973 self.addresses.clone().into(),
2974 self.subject.clone().into(),
2975 self.message.clone().into(),
2976 format!("{:?}", self.use_archive_version).into(),
2977 ]
2978 }
2979
2980 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2981 vec![
2982 "addresses".into(),
2983 "subject".into(),
2984 "message".into(),
2985 "use_archive_version".into(),
2986 ]
2987 }
2988}
2989
2990#[derive(
2991 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2992)]
2993#[allow(non_snake_case)]
2994pub struct EmailResponse {
2995 pub message: String,
2996}
2997
2998impl std::fmt::Display for EmailResponse {
2999 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3000 write!(
3001 f,
3002 "{}",
3003 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3004 )
3005 }
3006}
3007
3008#[cfg(feature = "tabled")]
3009impl tabled::Tabled for EmailResponse {
3010 const LENGTH: usize = 1;
3011 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3012 vec![self.message.clone().into()]
3013 }
3014
3015 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3016 vec!["message".into()]
3017 }
3018}
3019
3020#[doc = "* `archive` - Archive\n* `original` - Original"]
3021#[derive(
3022 serde :: Serialize,
3023 serde :: Deserialize,
3024 PartialEq,
3025 Hash,
3026 Debug,
3027 Clone,
3028 schemars :: JsonSchema,
3029 parse_display :: FromStr,
3030 parse_display :: Display,
3031)]
3032#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
3033#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
3034pub enum FileVersionEnum {
3035 #[serde(rename = "archive")]
3036 #[display("archive")]
3037 Archive,
3038 #[serde(rename = "original")]
3039 #[display("original")]
3040 Original,
3041}
3042
3043#[derive(
3044 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3045)]
3046#[allow(non_snake_case)]
3047pub struct Group {
3048 pub id: i64,
3049 pub name: String,
3050 pub permissions: Vec<String>,
3051}
3052
3053impl std::fmt::Display for Group {
3054 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3055 write!(
3056 f,
3057 "{}",
3058 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3059 )
3060 }
3061}
3062
3063#[cfg(feature = "tabled")]
3064impl tabled::Tabled for Group {
3065 const LENGTH: usize = 3;
3066 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3067 vec![
3068 format!("{:?}", self.id).into(),
3069 self.name.clone().into(),
3070 format!("{:?}", self.permissions).into(),
3071 ]
3072 }
3073
3074 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3075 vec!["id".into(), "name".into(), "permissions".into()]
3076 }
3077}
3078
3079#[derive(
3080 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3081)]
3082#[allow(non_snake_case)]
3083pub struct GroupRequest {
3084 pub name: String,
3085 pub permissions: Vec<String>,
3086}
3087
3088impl std::fmt::Display for GroupRequest {
3089 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3090 write!(
3091 f,
3092 "{}",
3093 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3094 )
3095 }
3096}
3097
3098#[cfg(feature = "tabled")]
3099impl tabled::Tabled for GroupRequest {
3100 const LENGTH: usize = 2;
3101 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3102 vec![
3103 self.name.clone().into(),
3104 format!("{:?}", self.permissions).into(),
3105 ]
3106 }
3107
3108 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3109 vec!["name".into(), "permissions".into()]
3110 }
3111}
3112
3113#[derive(
3114 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3115)]
3116#[allow(non_snake_case)]
3117pub struct Index {
3118 pub status: String,
3119 pub error: String,
3120 pub last_modified: chrono::DateTime<chrono::Utc>,
3121}
3122
3123impl std::fmt::Display for Index {
3124 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3125 write!(
3126 f,
3127 "{}",
3128 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3129 )
3130 }
3131}
3132
3133#[cfg(feature = "tabled")]
3134impl tabled::Tabled for Index {
3135 const LENGTH: usize = 3;
3136 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3137 vec![
3138 self.status.clone().into(),
3139 self.error.clone().into(),
3140 format!("{:?}", self.last_modified).into(),
3141 ]
3142 }
3143
3144 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3145 vec!["status".into(), "error".into(), "last_modified".into()]
3146 }
3147}
3148
3149#[derive(
3150 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3151)]
3152#[allow(non_snake_case)]
3153pub struct LogEntry {
3154 pub id: i64,
3155 pub timestamp: chrono::DateTime<chrono::Utc>,
3156 pub action: String,
3157 pub changes: std::collections::HashMap<String, serde_json::Value>,
3158 pub actor: Actor,
3159}
3160
3161impl std::fmt::Display for LogEntry {
3162 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3163 write!(
3164 f,
3165 "{}",
3166 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3167 )
3168 }
3169}
3170
3171#[cfg(feature = "tabled")]
3172impl tabled::Tabled for LogEntry {
3173 const LENGTH: usize = 5;
3174 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3175 vec![
3176 format!("{:?}", self.id).into(),
3177 format!("{:?}", self.timestamp).into(),
3178 self.action.clone().into(),
3179 format!("{:?}", self.changes).into(),
3180 format!("{:?}", self.actor).into(),
3181 ]
3182 }
3183
3184 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3185 vec![
3186 "id".into(),
3187 "timestamp".into(),
3188 "action".into(),
3189 "changes".into(),
3190 "actor".into(),
3191 ]
3192 }
3193}
3194
3195#[derive(
3196 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3197)]
3198#[allow(non_snake_case)]
3199pub struct MailAccount {
3200 pub id: i64,
3201 pub name: String,
3202 pub imap_server: String,
3203 #[doc = "This is usually 143 for unencrypted and STARTTLS connections, and 993 for SSL connections."]
3204 #[serde(default, skip_serializing_if = "Option::is_none")]
3205 pub imap_port: Option<i64>,
3206 #[serde(default, skip_serializing_if = "Option::is_none")]
3207 pub imap_security: Option<i64>,
3208 pub username: String,
3209 pub password: String,
3210 #[doc = "The character set to use when communicating with the mail server, such as 'UTF-8' or 'US-ASCII'."]
3211 #[serde(default, skip_serializing_if = "Option::is_none")]
3212 pub character_set: Option<String>,
3213 #[serde(default, skip_serializing_if = "Option::is_none")]
3214 pub is_token: Option<bool>,
3215 #[serde(default, skip_serializing_if = "Option::is_none")]
3216 pub owner: Option<i64>,
3217 pub user_can_change: bool,
3218 #[serde(default, skip_serializing_if = "Option::is_none")]
3219 pub account_type: Option<i64>,
3220 #[doc = "The expiration date of the refresh token. "]
3221 #[serde(default, skip_serializing_if = "Option::is_none")]
3222 pub expiration: Option<chrono::DateTime<chrono::Utc>>,
3223}
3224
3225impl std::fmt::Display for MailAccount {
3226 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3227 write!(
3228 f,
3229 "{}",
3230 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3231 )
3232 }
3233}
3234
3235#[cfg(feature = "tabled")]
3236impl tabled::Tabled for MailAccount {
3237 const LENGTH: usize = 13;
3238 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3239 vec![
3240 format!("{:?}", self.id).into(),
3241 self.name.clone().into(),
3242 self.imap_server.clone().into(),
3243 if let Some(imap_port) = &self.imap_port {
3244 format!("{imap_port:?}").into()
3245 } else {
3246 String::new().into()
3247 },
3248 if let Some(imap_security) = &self.imap_security {
3249 format!("{imap_security:?}").into()
3250 } else {
3251 String::new().into()
3252 },
3253 self.username.clone().into(),
3254 self.password.clone().into(),
3255 if let Some(character_set) = &self.character_set {
3256 format!("{character_set:?}").into()
3257 } else {
3258 String::new().into()
3259 },
3260 if let Some(is_token) = &self.is_token {
3261 format!("{is_token:?}").into()
3262 } else {
3263 String::new().into()
3264 },
3265 if let Some(owner) = &self.owner {
3266 format!("{owner:?}").into()
3267 } else {
3268 String::new().into()
3269 },
3270 format!("{:?}", self.user_can_change).into(),
3271 if let Some(account_type) = &self.account_type {
3272 format!("{account_type:?}").into()
3273 } else {
3274 String::new().into()
3275 },
3276 if let Some(expiration) = &self.expiration {
3277 format!("{expiration:?}").into()
3278 } else {
3279 String::new().into()
3280 },
3281 ]
3282 }
3283
3284 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3285 vec![
3286 "id".into(),
3287 "name".into(),
3288 "imap_server".into(),
3289 "imap_port".into(),
3290 "imap_security".into(),
3291 "username".into(),
3292 "password".into(),
3293 "character_set".into(),
3294 "is_token".into(),
3295 "owner".into(),
3296 "user_can_change".into(),
3297 "account_type".into(),
3298 "expiration".into(),
3299 ]
3300 }
3301}
3302
3303#[derive(
3304 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3305)]
3306#[allow(non_snake_case)]
3307pub struct MailAccountProcessResponse {
3308 #[serde(default, skip_serializing_if = "Option::is_none")]
3309 pub result: Option<String>,
3310}
3311
3312impl std::fmt::Display for MailAccountProcessResponse {
3313 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3314 write!(
3315 f,
3316 "{}",
3317 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3318 )
3319 }
3320}
3321
3322#[cfg(feature = "tabled")]
3323impl tabled::Tabled for MailAccountProcessResponse {
3324 const LENGTH: usize = 1;
3325 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3326 vec![if let Some(result) = &self.result {
3327 format!("{result:?}").into()
3328 } else {
3329 String::new().into()
3330 }]
3331 }
3332
3333 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3334 vec!["result".into()]
3335 }
3336}
3337
3338#[derive(
3339 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3340)]
3341#[allow(non_snake_case)]
3342pub struct MailAccountRequest {
3343 pub name: String,
3344 pub imap_server: String,
3345 #[doc = "This is usually 143 for unencrypted and STARTTLS connections, and 993 for SSL connections."]
3346 #[serde(default, skip_serializing_if = "Option::is_none")]
3347 pub imap_port: Option<i64>,
3348 #[serde(default, skip_serializing_if = "Option::is_none")]
3349 pub imap_security: Option<i64>,
3350 pub username: String,
3351 pub password: String,
3352 #[doc = "The character set to use when communicating with the mail server, such as 'UTF-8' or 'US-ASCII'."]
3353 #[serde(default, skip_serializing_if = "Option::is_none")]
3354 pub character_set: Option<String>,
3355 #[serde(default, skip_serializing_if = "Option::is_none")]
3356 pub is_token: Option<bool>,
3357 #[serde(default, skip_serializing_if = "Option::is_none")]
3358 pub owner: Option<i64>,
3359 #[serde(default, skip_serializing_if = "Option::is_none")]
3360 pub set_permissions: Option<SetPermissions>,
3361 #[serde(default, skip_serializing_if = "Option::is_none")]
3362 pub account_type: Option<i64>,
3363 #[doc = "The expiration date of the refresh token. "]
3364 #[serde(default, skip_serializing_if = "Option::is_none")]
3365 pub expiration: Option<chrono::DateTime<chrono::Utc>>,
3366}
3367
3368impl std::fmt::Display for MailAccountRequest {
3369 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3370 write!(
3371 f,
3372 "{}",
3373 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3374 )
3375 }
3376}
3377
3378#[cfg(feature = "tabled")]
3379impl tabled::Tabled for MailAccountRequest {
3380 const LENGTH: usize = 12;
3381 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3382 vec![
3383 self.name.clone().into(),
3384 self.imap_server.clone().into(),
3385 if let Some(imap_port) = &self.imap_port {
3386 format!("{imap_port:?}").into()
3387 } else {
3388 String::new().into()
3389 },
3390 if let Some(imap_security) = &self.imap_security {
3391 format!("{imap_security:?}").into()
3392 } else {
3393 String::new().into()
3394 },
3395 self.username.clone().into(),
3396 self.password.clone().into(),
3397 if let Some(character_set) = &self.character_set {
3398 format!("{character_set:?}").into()
3399 } else {
3400 String::new().into()
3401 },
3402 if let Some(is_token) = &self.is_token {
3403 format!("{is_token:?}").into()
3404 } else {
3405 String::new().into()
3406 },
3407 if let Some(owner) = &self.owner {
3408 format!("{owner:?}").into()
3409 } else {
3410 String::new().into()
3411 },
3412 if let Some(set_permissions) = &self.set_permissions {
3413 format!("{set_permissions:?}").into()
3414 } else {
3415 String::new().into()
3416 },
3417 if let Some(account_type) = &self.account_type {
3418 format!("{account_type:?}").into()
3419 } else {
3420 String::new().into()
3421 },
3422 if let Some(expiration) = &self.expiration {
3423 format!("{expiration:?}").into()
3424 } else {
3425 String::new().into()
3426 },
3427 ]
3428 }
3429
3430 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3431 vec![
3432 "name".into(),
3433 "imap_server".into(),
3434 "imap_port".into(),
3435 "imap_security".into(),
3436 "username".into(),
3437 "password".into(),
3438 "character_set".into(),
3439 "is_token".into(),
3440 "owner".into(),
3441 "set_permissions".into(),
3442 "account_type".into(),
3443 "expiration".into(),
3444 ]
3445 }
3446}
3447
3448#[derive(
3449 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3450)]
3451#[allow(non_snake_case)]
3452pub struct MailAccountTestResponse {
3453 pub success: bool,
3454}
3455
3456impl std::fmt::Display for MailAccountTestResponse {
3457 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3458 write!(
3459 f,
3460 "{}",
3461 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3462 )
3463 }
3464}
3465
3466#[cfg(feature = "tabled")]
3467impl tabled::Tabled for MailAccountTestResponse {
3468 const LENGTH: usize = 1;
3469 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3470 vec![format!("{:?}", self.success).into()]
3471 }
3472
3473 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3474 vec!["success".into()]
3475 }
3476}
3477
3478#[derive(
3479 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3480)]
3481#[allow(non_snake_case)]
3482pub struct MailRule {
3483 pub id: i64,
3484 pub name: String,
3485 pub account: i64,
3486 #[serde(default, skip_serializing_if = "Option::is_none")]
3487 pub enabled: Option<bool>,
3488 #[doc = "Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server."]
3489 #[serde(default, skip_serializing_if = "Option::is_none")]
3490 pub folder: Option<String>,
3491 #[serde(default, skip_serializing_if = "Option::is_none")]
3492 pub filter_from: Option<String>,
3493 #[serde(default, skip_serializing_if = "Option::is_none")]
3494 pub filter_to: Option<String>,
3495 #[serde(default, skip_serializing_if = "Option::is_none")]
3496 pub filter_subject: Option<String>,
3497 #[serde(default, skip_serializing_if = "Option::is_none")]
3498 pub filter_body: Option<String>,
3499 #[doc = "Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
3500 #[serde(default, skip_serializing_if = "Option::is_none")]
3501 pub filter_attachment_filename_include: Option<String>,
3502 #[doc = "Do not consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
3503 #[serde(default, skip_serializing_if = "Option::is_none")]
3504 pub filter_attachment_filename_exclude: Option<String>,
3505 #[doc = "Specified in days."]
3506 #[serde(default, skip_serializing_if = "Option::is_none")]
3507 pub maximum_age: Option<i64>,
3508 #[serde(default, skip_serializing_if = "Option::is_none")]
3509 pub action: Option<i64>,
3510 #[serde(default, skip_serializing_if = "Option::is_none")]
3511 pub action_parameter: Option<String>,
3512 #[serde(default, skip_serializing_if = "Option::is_none")]
3513 pub assign_title_from: Option<i64>,
3514 #[serde(default, skip_serializing_if = "Option::is_none")]
3515 pub assign_tags: Option<Vec<Option<i64>>>,
3516 #[serde(default, skip_serializing_if = "Option::is_none")]
3517 pub assign_correspondent_from: Option<i64>,
3518 #[serde(default, skip_serializing_if = "Option::is_none")]
3519 pub assign_correspondent: Option<i64>,
3520 #[serde(default, skip_serializing_if = "Option::is_none")]
3521 pub assign_document_type: Option<i64>,
3522 #[serde(default, skip_serializing_if = "Option::is_none")]
3523 pub assign_owner_from_rule: Option<bool>,
3524 #[serde(default, skip_serializing_if = "Option::is_none")]
3525 pub order: Option<i64>,
3526 #[doc = "Inline attachments include embedded images, so it's best to combine this option with a filename filter.\n\n* `1` - Only process attachments.\n* `2` - Process all files, including 'inline' attachments."]
3527 #[serde(default, skip_serializing_if = "Option::is_none")]
3528 pub attachment_type: Option<i64>,
3529 #[serde(default, skip_serializing_if = "Option::is_none")]
3530 pub consumption_scope: Option<i64>,
3531 #[serde(default, skip_serializing_if = "Option::is_none")]
3532 pub pdf_layout: Option<i64>,
3533 #[serde(default, skip_serializing_if = "Option::is_none")]
3534 pub owner: Option<i64>,
3535 pub user_can_change: bool,
3536}
3537
3538impl std::fmt::Display for MailRule {
3539 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3540 write!(
3541 f,
3542 "{}",
3543 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3544 )
3545 }
3546}
3547
3548#[cfg(feature = "tabled")]
3549impl tabled::Tabled for MailRule {
3550 const LENGTH: usize = 26;
3551 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3552 vec![
3553 format!("{:?}", self.id).into(),
3554 self.name.clone().into(),
3555 format!("{:?}", self.account).into(),
3556 if let Some(enabled) = &self.enabled {
3557 format!("{enabled:?}").into()
3558 } else {
3559 String::new().into()
3560 },
3561 if let Some(folder) = &self.folder {
3562 format!("{folder:?}").into()
3563 } else {
3564 String::new().into()
3565 },
3566 if let Some(filter_from) = &self.filter_from {
3567 format!("{filter_from:?}").into()
3568 } else {
3569 String::new().into()
3570 },
3571 if let Some(filter_to) = &self.filter_to {
3572 format!("{filter_to:?}").into()
3573 } else {
3574 String::new().into()
3575 },
3576 if let Some(filter_subject) = &self.filter_subject {
3577 format!("{filter_subject:?}").into()
3578 } else {
3579 String::new().into()
3580 },
3581 if let Some(filter_body) = &self.filter_body {
3582 format!("{filter_body:?}").into()
3583 } else {
3584 String::new().into()
3585 },
3586 if let Some(filter_attachment_filename_include) =
3587 &self.filter_attachment_filename_include
3588 {
3589 format!("{filter_attachment_filename_include:?}").into()
3590 } else {
3591 String::new().into()
3592 },
3593 if let Some(filter_attachment_filename_exclude) =
3594 &self.filter_attachment_filename_exclude
3595 {
3596 format!("{filter_attachment_filename_exclude:?}").into()
3597 } else {
3598 String::new().into()
3599 },
3600 if let Some(maximum_age) = &self.maximum_age {
3601 format!("{maximum_age:?}").into()
3602 } else {
3603 String::new().into()
3604 },
3605 if let Some(action) = &self.action {
3606 format!("{action:?}").into()
3607 } else {
3608 String::new().into()
3609 },
3610 if let Some(action_parameter) = &self.action_parameter {
3611 format!("{action_parameter:?}").into()
3612 } else {
3613 String::new().into()
3614 },
3615 if let Some(assign_title_from) = &self.assign_title_from {
3616 format!("{assign_title_from:?}").into()
3617 } else {
3618 String::new().into()
3619 },
3620 if let Some(assign_tags) = &self.assign_tags {
3621 format!("{assign_tags:?}").into()
3622 } else {
3623 String::new().into()
3624 },
3625 if let Some(assign_correspondent_from) = &self.assign_correspondent_from {
3626 format!("{assign_correspondent_from:?}").into()
3627 } else {
3628 String::new().into()
3629 },
3630 if let Some(assign_correspondent) = &self.assign_correspondent {
3631 format!("{assign_correspondent:?}").into()
3632 } else {
3633 String::new().into()
3634 },
3635 if let Some(assign_document_type) = &self.assign_document_type {
3636 format!("{assign_document_type:?}").into()
3637 } else {
3638 String::new().into()
3639 },
3640 if let Some(assign_owner_from_rule) = &self.assign_owner_from_rule {
3641 format!("{assign_owner_from_rule:?}").into()
3642 } else {
3643 String::new().into()
3644 },
3645 if let Some(order) = &self.order {
3646 format!("{order:?}").into()
3647 } else {
3648 String::new().into()
3649 },
3650 if let Some(attachment_type) = &self.attachment_type {
3651 format!("{attachment_type:?}").into()
3652 } else {
3653 String::new().into()
3654 },
3655 if let Some(consumption_scope) = &self.consumption_scope {
3656 format!("{consumption_scope:?}").into()
3657 } else {
3658 String::new().into()
3659 },
3660 if let Some(pdf_layout) = &self.pdf_layout {
3661 format!("{pdf_layout:?}").into()
3662 } else {
3663 String::new().into()
3664 },
3665 if let Some(owner) = &self.owner {
3666 format!("{owner:?}").into()
3667 } else {
3668 String::new().into()
3669 },
3670 format!("{:?}", self.user_can_change).into(),
3671 ]
3672 }
3673
3674 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3675 vec![
3676 "id".into(),
3677 "name".into(),
3678 "account".into(),
3679 "enabled".into(),
3680 "folder".into(),
3681 "filter_from".into(),
3682 "filter_to".into(),
3683 "filter_subject".into(),
3684 "filter_body".into(),
3685 "filter_attachment_filename_include".into(),
3686 "filter_attachment_filename_exclude".into(),
3687 "maximum_age".into(),
3688 "action".into(),
3689 "action_parameter".into(),
3690 "assign_title_from".into(),
3691 "assign_tags".into(),
3692 "assign_correspondent_from".into(),
3693 "assign_correspondent".into(),
3694 "assign_document_type".into(),
3695 "assign_owner_from_rule".into(),
3696 "order".into(),
3697 "attachment_type".into(),
3698 "consumption_scope".into(),
3699 "pdf_layout".into(),
3700 "owner".into(),
3701 "user_can_change".into(),
3702 ]
3703 }
3704}
3705
3706#[derive(
3707 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3708)]
3709#[allow(non_snake_case)]
3710pub struct MailRuleRequest {
3711 pub name: String,
3712 pub account: i64,
3713 #[serde(default, skip_serializing_if = "Option::is_none")]
3714 pub enabled: Option<bool>,
3715 #[doc = "Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server."]
3716 #[serde(default, skip_serializing_if = "Option::is_none")]
3717 pub folder: Option<String>,
3718 #[serde(default, skip_serializing_if = "Option::is_none")]
3719 pub filter_from: Option<String>,
3720 #[serde(default, skip_serializing_if = "Option::is_none")]
3721 pub filter_to: Option<String>,
3722 #[serde(default, skip_serializing_if = "Option::is_none")]
3723 pub filter_subject: Option<String>,
3724 #[serde(default, skip_serializing_if = "Option::is_none")]
3725 pub filter_body: Option<String>,
3726 #[doc = "Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
3727 #[serde(default, skip_serializing_if = "Option::is_none")]
3728 pub filter_attachment_filename_include: Option<String>,
3729 #[doc = "Do not consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
3730 #[serde(default, skip_serializing_if = "Option::is_none")]
3731 pub filter_attachment_filename_exclude: Option<String>,
3732 #[doc = "Specified in days."]
3733 #[serde(default, skip_serializing_if = "Option::is_none")]
3734 pub maximum_age: Option<i64>,
3735 #[serde(default, skip_serializing_if = "Option::is_none")]
3736 pub action: Option<i64>,
3737 #[serde(default, skip_serializing_if = "Option::is_none")]
3738 pub action_parameter: Option<String>,
3739 #[serde(default, skip_serializing_if = "Option::is_none")]
3740 pub assign_title_from: Option<i64>,
3741 #[serde(default, skip_serializing_if = "Option::is_none")]
3742 pub assign_tags: Option<Vec<Option<i64>>>,
3743 #[serde(default, skip_serializing_if = "Option::is_none")]
3744 pub assign_correspondent_from: Option<i64>,
3745 #[serde(default, skip_serializing_if = "Option::is_none")]
3746 pub assign_correspondent: Option<i64>,
3747 #[serde(default, skip_serializing_if = "Option::is_none")]
3748 pub assign_document_type: Option<i64>,
3749 #[serde(default, skip_serializing_if = "Option::is_none")]
3750 pub assign_owner_from_rule: Option<bool>,
3751 #[serde(default, skip_serializing_if = "Option::is_none")]
3752 pub order: Option<i64>,
3753 #[doc = "Inline attachments include embedded images, so it's best to combine this option with a filename filter.\n\n* `1` - Only process attachments.\n* `2` - Process all files, including 'inline' attachments."]
3754 #[serde(default, skip_serializing_if = "Option::is_none")]
3755 pub attachment_type: Option<i64>,
3756 #[serde(default, skip_serializing_if = "Option::is_none")]
3757 pub consumption_scope: Option<i64>,
3758 #[serde(default, skip_serializing_if = "Option::is_none")]
3759 pub pdf_layout: Option<i64>,
3760 #[serde(default, skip_serializing_if = "Option::is_none")]
3761 pub owner: Option<i64>,
3762 #[serde(default, skip_serializing_if = "Option::is_none")]
3763 pub set_permissions: Option<SetPermissions>,
3764}
3765
3766impl std::fmt::Display for MailRuleRequest {
3767 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3768 write!(
3769 f,
3770 "{}",
3771 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3772 )
3773 }
3774}
3775
3776#[cfg(feature = "tabled")]
3777impl tabled::Tabled for MailRuleRequest {
3778 const LENGTH: usize = 25;
3779 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3780 vec![
3781 self.name.clone().into(),
3782 format!("{:?}", self.account).into(),
3783 if let Some(enabled) = &self.enabled {
3784 format!("{enabled:?}").into()
3785 } else {
3786 String::new().into()
3787 },
3788 if let Some(folder) = &self.folder {
3789 format!("{folder:?}").into()
3790 } else {
3791 String::new().into()
3792 },
3793 if let Some(filter_from) = &self.filter_from {
3794 format!("{filter_from:?}").into()
3795 } else {
3796 String::new().into()
3797 },
3798 if let Some(filter_to) = &self.filter_to {
3799 format!("{filter_to:?}").into()
3800 } else {
3801 String::new().into()
3802 },
3803 if let Some(filter_subject) = &self.filter_subject {
3804 format!("{filter_subject:?}").into()
3805 } else {
3806 String::new().into()
3807 },
3808 if let Some(filter_body) = &self.filter_body {
3809 format!("{filter_body:?}").into()
3810 } else {
3811 String::new().into()
3812 },
3813 if let Some(filter_attachment_filename_include) =
3814 &self.filter_attachment_filename_include
3815 {
3816 format!("{filter_attachment_filename_include:?}").into()
3817 } else {
3818 String::new().into()
3819 },
3820 if let Some(filter_attachment_filename_exclude) =
3821 &self.filter_attachment_filename_exclude
3822 {
3823 format!("{filter_attachment_filename_exclude:?}").into()
3824 } else {
3825 String::new().into()
3826 },
3827 if let Some(maximum_age) = &self.maximum_age {
3828 format!("{maximum_age:?}").into()
3829 } else {
3830 String::new().into()
3831 },
3832 if let Some(action) = &self.action {
3833 format!("{action:?}").into()
3834 } else {
3835 String::new().into()
3836 },
3837 if let Some(action_parameter) = &self.action_parameter {
3838 format!("{action_parameter:?}").into()
3839 } else {
3840 String::new().into()
3841 },
3842 if let Some(assign_title_from) = &self.assign_title_from {
3843 format!("{assign_title_from:?}").into()
3844 } else {
3845 String::new().into()
3846 },
3847 if let Some(assign_tags) = &self.assign_tags {
3848 format!("{assign_tags:?}").into()
3849 } else {
3850 String::new().into()
3851 },
3852 if let Some(assign_correspondent_from) = &self.assign_correspondent_from {
3853 format!("{assign_correspondent_from:?}").into()
3854 } else {
3855 String::new().into()
3856 },
3857 if let Some(assign_correspondent) = &self.assign_correspondent {
3858 format!("{assign_correspondent:?}").into()
3859 } else {
3860 String::new().into()
3861 },
3862 if let Some(assign_document_type) = &self.assign_document_type {
3863 format!("{assign_document_type:?}").into()
3864 } else {
3865 String::new().into()
3866 },
3867 if let Some(assign_owner_from_rule) = &self.assign_owner_from_rule {
3868 format!("{assign_owner_from_rule:?}").into()
3869 } else {
3870 String::new().into()
3871 },
3872 if let Some(order) = &self.order {
3873 format!("{order:?}").into()
3874 } else {
3875 String::new().into()
3876 },
3877 if let Some(attachment_type) = &self.attachment_type {
3878 format!("{attachment_type:?}").into()
3879 } else {
3880 String::new().into()
3881 },
3882 if let Some(consumption_scope) = &self.consumption_scope {
3883 format!("{consumption_scope:?}").into()
3884 } else {
3885 String::new().into()
3886 },
3887 if let Some(pdf_layout) = &self.pdf_layout {
3888 format!("{pdf_layout:?}").into()
3889 } else {
3890 String::new().into()
3891 },
3892 if let Some(owner) = &self.owner {
3893 format!("{owner:?}").into()
3894 } else {
3895 String::new().into()
3896 },
3897 if let Some(set_permissions) = &self.set_permissions {
3898 format!("{set_permissions:?}").into()
3899 } else {
3900 String::new().into()
3901 },
3902 ]
3903 }
3904
3905 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3906 vec![
3907 "name".into(),
3908 "account".into(),
3909 "enabled".into(),
3910 "folder".into(),
3911 "filter_from".into(),
3912 "filter_to".into(),
3913 "filter_subject".into(),
3914 "filter_body".into(),
3915 "filter_attachment_filename_include".into(),
3916 "filter_attachment_filename_exclude".into(),
3917 "maximum_age".into(),
3918 "action".into(),
3919 "action_parameter".into(),
3920 "assign_title_from".into(),
3921 "assign_tags".into(),
3922 "assign_correspondent_from".into(),
3923 "assign_correspondent".into(),
3924 "assign_document_type".into(),
3925 "assign_owner_from_rule".into(),
3926 "order".into(),
3927 "attachment_type".into(),
3928 "consumption_scope".into(),
3929 "pdf_layout".into(),
3930 "owner".into(),
3931 "set_permissions".into(),
3932 ]
3933 }
3934}
3935
3936#[derive(
3937 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
3938)]
3939#[allow(non_snake_case)]
3940pub struct Metadata {
3941 pub original_checksum: String,
3942 pub original_size: i64,
3943 pub original_mime_type: String,
3944 pub media_filename: String,
3945 pub has_archive_version: bool,
3946 pub original_metadata: std::collections::HashMap<String, serde_json::Value>,
3947 pub archive_checksum: String,
3948 pub archive_media_filename: String,
3949 pub original_filename: String,
3950 pub archive_size: i64,
3951 pub archive_metadata: std::collections::HashMap<String, serde_json::Value>,
3952 pub lang: String,
3953}
3954
3955impl std::fmt::Display for Metadata {
3956 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
3957 write!(
3958 f,
3959 "{}",
3960 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
3961 )
3962 }
3963}
3964
3965#[cfg(feature = "tabled")]
3966impl tabled::Tabled for Metadata {
3967 const LENGTH: usize = 12;
3968 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
3969 vec![
3970 self.original_checksum.clone().into(),
3971 format!("{:?}", self.original_size).into(),
3972 self.original_mime_type.clone().into(),
3973 self.media_filename.clone().into(),
3974 format!("{:?}", self.has_archive_version).into(),
3975 format!("{:?}", self.original_metadata).into(),
3976 self.archive_checksum.clone().into(),
3977 self.archive_media_filename.clone().into(),
3978 self.original_filename.clone().into(),
3979 format!("{:?}", self.archive_size).into(),
3980 format!("{:?}", self.archive_metadata).into(),
3981 self.lang.clone().into(),
3982 ]
3983 }
3984
3985 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
3986 vec![
3987 "original_checksum".into(),
3988 "original_size".into(),
3989 "original_mime_type".into(),
3990 "media_filename".into(),
3991 "has_archive_version".into(),
3992 "original_metadata".into(),
3993 "archive_checksum".into(),
3994 "archive_media_filename".into(),
3995 "original_filename".into(),
3996 "archive_size".into(),
3997 "archive_metadata".into(),
3998 "lang".into(),
3999 ]
4000 }
4001}
4002
4003#[doc = "* `set_correspondent` - set_correspondent\n* `set_document_type` - set_document_type\n* `set_storage_path` - set_storage_path\n* `add_tag` - add_tag\n* `remove_tag` - remove_tag\n* `modify_tags` - modify_tags\n* `modify_custom_fields` - modify_custom_fields\n* `delete` - delete\n* `reprocess` - reprocess\n* `set_permissions` - set_permissions\n* `rotate` - rotate\n* `merge` - merge\n* `split` - split\n* `delete_pages` - delete_pages\n* `edit_pdf` - edit_pdf"]
4004#[derive(
4005 serde :: Serialize,
4006 serde :: Deserialize,
4007 PartialEq,
4008 Hash,
4009 Debug,
4010 Clone,
4011 schemars :: JsonSchema,
4012 parse_display :: FromStr,
4013 parse_display :: Display,
4014)]
4015#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
4016#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
4017pub enum MethodEnum {
4018 #[serde(rename = "set_correspondent")]
4019 #[display("set_correspondent")]
4020 SetCorrespondent,
4021 #[serde(rename = "set_document_type")]
4022 #[display("set_document_type")]
4023 SetDocumentType,
4024 #[serde(rename = "set_storage_path")]
4025 #[display("set_storage_path")]
4026 SetStoragePath,
4027 #[serde(rename = "add_tag")]
4028 #[display("add_tag")]
4029 AddTag,
4030 #[serde(rename = "remove_tag")]
4031 #[display("remove_tag")]
4032 RemoveTag,
4033 #[serde(rename = "modify_tags")]
4034 #[display("modify_tags")]
4035 ModifyTags,
4036 #[serde(rename = "modify_custom_fields")]
4037 #[display("modify_custom_fields")]
4038 ModifyCustomFields,
4039 #[serde(rename = "delete")]
4040 #[display("delete")]
4041 Delete,
4042 #[serde(rename = "reprocess")]
4043 #[display("reprocess")]
4044 Reprocess,
4045 #[serde(rename = "set_permissions")]
4046 #[display("set_permissions")]
4047 SetPermissions,
4048 #[serde(rename = "rotate")]
4049 #[display("rotate")]
4050 Rotate,
4051 #[serde(rename = "merge")]
4052 #[display("merge")]
4053 Merge,
4054 #[serde(rename = "split")]
4055 #[display("split")]
4056 Split,
4057 #[serde(rename = "delete_pages")]
4058 #[display("delete_pages")]
4059 DeletePages,
4060 #[serde(rename = "edit_pdf")]
4061 #[display("edit_pdf")]
4062 EditPdf,
4063}
4064
4065#[derive(
4066 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4067)]
4068#[allow(non_snake_case)]
4069pub struct MigrationStatus {
4070 pub latest_migration: String,
4071 pub unapplied_migrations: Vec<String>,
4072}
4073
4074impl std::fmt::Display for MigrationStatus {
4075 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4076 write!(
4077 f,
4078 "{}",
4079 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4080 )
4081 }
4082}
4083
4084#[cfg(feature = "tabled")]
4085impl tabled::Tabled for MigrationStatus {
4086 const LENGTH: usize = 2;
4087 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4088 vec![
4089 self.latest_migration.clone().into(),
4090 format!("{:?}", self.unapplied_migrations).into(),
4091 ]
4092 }
4093
4094 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4095 vec!["latest_migration".into(), "unapplied_migrations".into()]
4096 }
4097}
4098
4099#[doc = "* `skip` - skip\n* `redo` - redo\n* `force` - force\n* `skip_noarchive` - skip_noarchive"]
4100#[derive(
4101 serde :: Serialize,
4102 serde :: Deserialize,
4103 PartialEq,
4104 Hash,
4105 Debug,
4106 Clone,
4107 schemars :: JsonSchema,
4108 parse_display :: FromStr,
4109 parse_display :: Display,
4110)]
4111#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
4112#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
4113pub enum ModeEnum {
4114 #[serde(rename = "skip")]
4115 #[display("skip")]
4116 Skip,
4117 #[serde(rename = "redo")]
4118 #[display("redo")]
4119 Redo,
4120 #[serde(rename = "force")]
4121 #[display("force")]
4122 Force,
4123 #[serde(rename = "skip_noarchive")]
4124 #[display("skip_noarchive")]
4125 SkipNoarchive,
4126 #[serde(rename = "")]
4127 #[display("")]
4128 Empty,
4129}
4130
4131#[derive(
4132 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4133)]
4134#[allow(non_snake_case)]
4135pub struct NoteCreateRequestRequest {
4136 pub note: String,
4137}
4138
4139impl std::fmt::Display for NoteCreateRequestRequest {
4140 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4141 write!(
4142 f,
4143 "{}",
4144 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4145 )
4146 }
4147}
4148
4149#[cfg(feature = "tabled")]
4150impl tabled::Tabled for NoteCreateRequestRequest {
4151 const LENGTH: usize = 1;
4152 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4153 vec![self.note.clone().into()]
4154 }
4155
4156 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4157 vec!["note".into()]
4158 }
4159}
4160
4161#[derive(
4162 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4163)]
4164#[allow(non_snake_case)]
4165pub struct Notes {
4166 pub id: i64,
4167 #[doc = "Note for the document"]
4168 #[serde(default, skip_serializing_if = "Option::is_none")]
4169 pub note: Option<String>,
4170 #[serde(default, skip_serializing_if = "Option::is_none")]
4171 pub created: Option<chrono::DateTime<chrono::Utc>>,
4172 pub user: BasicUser,
4173}
4174
4175impl std::fmt::Display for Notes {
4176 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4177 write!(
4178 f,
4179 "{}",
4180 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4181 )
4182 }
4183}
4184
4185#[cfg(feature = "tabled")]
4186impl tabled::Tabled for Notes {
4187 const LENGTH: usize = 4;
4188 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4189 vec![
4190 format!("{:?}", self.id).into(),
4191 if let Some(note) = &self.note {
4192 format!("{note:?}").into()
4193 } else {
4194 String::new().into()
4195 },
4196 if let Some(created) = &self.created {
4197 format!("{created:?}").into()
4198 } else {
4199 String::new().into()
4200 },
4201 format!("{:?}", self.user).into(),
4202 ]
4203 }
4204
4205 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4206 vec!["id".into(), "note".into(), "created".into(), "user".into()]
4207 }
4208}
4209
4210#[derive(
4211 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4212)]
4213#[allow(non_snake_case)]
4214pub struct NotesRequest {
4215 #[doc = "Note for the document"]
4216 #[serde(default, skip_serializing_if = "Option::is_none")]
4217 pub note: Option<String>,
4218 #[serde(default, skip_serializing_if = "Option::is_none")]
4219 pub created: Option<chrono::DateTime<chrono::Utc>>,
4220}
4221
4222impl std::fmt::Display for NotesRequest {
4223 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4224 write!(
4225 f,
4226 "{}",
4227 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4228 )
4229 }
4230}
4231
4232#[cfg(feature = "tabled")]
4233impl tabled::Tabled for NotesRequest {
4234 const LENGTH: usize = 2;
4235 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4236 vec![
4237 if let Some(note) = &self.note {
4238 format!("{note:?}").into()
4239 } else {
4240 String::new().into()
4241 },
4242 if let Some(created) = &self.created {
4243 format!("{created:?}").into()
4244 } else {
4245 String::new().into()
4246 },
4247 ]
4248 }
4249
4250 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4251 vec!["note".into(), "created".into()]
4252 }
4253}
4254
4255#[doc = "* `tags` - tags\n* `correspondents` - correspondents\n* `document_types` - document_types\n* `storage_paths` - storage_paths"]
4256#[derive(
4257 serde :: Serialize,
4258 serde :: Deserialize,
4259 PartialEq,
4260 Hash,
4261 Debug,
4262 Clone,
4263 schemars :: JsonSchema,
4264 parse_display :: FromStr,
4265 parse_display :: Display,
4266)]
4267#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
4268#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
4269pub enum ObjectTypeEnum {
4270 #[serde(rename = "tags")]
4271 #[display("tags")]
4272 Tags,
4273 #[serde(rename = "correspondents")]
4274 #[display("correspondents")]
4275 Correspondents,
4276 #[serde(rename = "document_types")]
4277 #[display("document_types")]
4278 DocumentTypes,
4279 #[serde(rename = "storage_paths")]
4280 #[display("storage_paths")]
4281 StoragePaths,
4282}
4283
4284#[doc = "* `set_permissions` - set_permissions\n* `delete` - delete"]
4285#[derive(
4286 serde :: Serialize,
4287 serde :: Deserialize,
4288 PartialEq,
4289 Hash,
4290 Debug,
4291 Clone,
4292 schemars :: JsonSchema,
4293 parse_display :: FromStr,
4294 parse_display :: Display,
4295)]
4296#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
4297#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
4298pub enum OperationEnum {
4299 #[serde(rename = "set_permissions")]
4300 #[display("set_permissions")]
4301 SetPermissions,
4302 #[serde(rename = "delete")]
4303 #[display("delete")]
4304 Delete,
4305}
4306
4307#[doc = "* `pdf` - pdf\n* `pdfa` - pdfa\n* `pdfa-1` - pdfa-1\n* `pdfa-2` - pdfa-2\n* `pdfa-3` - pdfa-3"]
4308#[derive(
4309 serde :: Serialize,
4310 serde :: Deserialize,
4311 PartialEq,
4312 Hash,
4313 Debug,
4314 Clone,
4315 schemars :: JsonSchema,
4316 parse_display :: FromStr,
4317 parse_display :: Display,
4318)]
4319#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
4320#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
4321pub enum OutputTypeEnum {
4322 #[serde(rename = "pdf")]
4323 #[display("pdf")]
4324 Pdf,
4325 #[serde(rename = "pdfa")]
4326 #[display("pdfa")]
4327 Pdfa,
4328 #[serde(rename = "pdfa-1")]
4329 #[display("pdfa-1")]
4330 Pdfa1,
4331 #[serde(rename = "pdfa-2")]
4332 #[display("pdfa-2")]
4333 Pdfa2,
4334 #[serde(rename = "pdfa-3")]
4335 #[display("pdfa-3")]
4336 Pdfa3,
4337 #[serde(rename = "")]
4338 #[display("")]
4339 Empty,
4340}
4341
4342#[derive(
4343 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4344)]
4345#[allow(non_snake_case)]
4346pub struct PaginatedCorrespondentList {
4347 pub count: i64,
4348 #[serde(default, skip_serializing_if = "Option::is_none")]
4349 pub next: Option<String>,
4350 #[serde(default, skip_serializing_if = "Option::is_none")]
4351 pub previous: Option<String>,
4352 pub results: Vec<Correspondent>,
4353 #[serde(default, skip_serializing_if = "Option::is_none")]
4354 pub all: Option<Vec<i64>>,
4355}
4356
4357impl std::fmt::Display for PaginatedCorrespondentList {
4358 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4359 write!(
4360 f,
4361 "{}",
4362 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4363 )
4364 }
4365}
4366
4367#[cfg(feature = "requests")]
4368impl crate::types::paginate::Pagination for PaginatedCorrespondentList {
4369 type Item = Correspondent;
4370 fn has_more_pages(&self) -> bool {
4371 self.next.is_some()
4372 }
4373
4374 fn next_page_token(&self) -> Option<String> {
4375 self.next.clone()
4376 }
4377
4378 fn next_page(
4379 &self,
4380 req: reqwest::Request,
4381 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
4382 let mut req = req.try_clone().ok_or_else(|| {
4383 crate::types::error::Error::InvalidRequest(format!(
4384 "failed to clone request: {req:?}"
4385 ))
4386 })?;
4387 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
4388 crate::types::error::Error::InvalidRequest(format!(
4389 "failed to parse url: {:?}",
4390 self.next
4391 ))
4392 })?;
4393 Ok(req)
4394 }
4395
4396 fn items(&self) -> Vec<Self::Item> {
4397 self.results.clone()
4398 }
4399}
4400
4401#[cfg(feature = "tabled")]
4402impl tabled::Tabled for PaginatedCorrespondentList {
4403 const LENGTH: usize = 5;
4404 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4405 vec![
4406 format!("{:?}", self.count).into(),
4407 if let Some(next) = &self.next {
4408 format!("{next:?}").into()
4409 } else {
4410 String::new().into()
4411 },
4412 if let Some(previous) = &self.previous {
4413 format!("{previous:?}").into()
4414 } else {
4415 String::new().into()
4416 },
4417 format!("{:?}", self.results).into(),
4418 if let Some(all) = &self.all {
4419 format!("{all:?}").into()
4420 } else {
4421 String::new().into()
4422 },
4423 ]
4424 }
4425
4426 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4427 vec![
4428 "count".into(),
4429 "next".into(),
4430 "previous".into(),
4431 "results".into(),
4432 "all".into(),
4433 ]
4434 }
4435}
4436
4437#[derive(
4438 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4439)]
4440#[allow(non_snake_case)]
4441pub struct PaginatedCustomFieldList {
4442 pub count: i64,
4443 #[serde(default, skip_serializing_if = "Option::is_none")]
4444 pub next: Option<String>,
4445 #[serde(default, skip_serializing_if = "Option::is_none")]
4446 pub previous: Option<String>,
4447 pub results: Vec<CustomField>,
4448 #[serde(default, skip_serializing_if = "Option::is_none")]
4449 pub all: Option<Vec<i64>>,
4450}
4451
4452impl std::fmt::Display for PaginatedCustomFieldList {
4453 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4454 write!(
4455 f,
4456 "{}",
4457 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4458 )
4459 }
4460}
4461
4462#[cfg(feature = "requests")]
4463impl crate::types::paginate::Pagination for PaginatedCustomFieldList {
4464 type Item = CustomField;
4465 fn has_more_pages(&self) -> bool {
4466 self.next.is_some()
4467 }
4468
4469 fn next_page_token(&self) -> Option<String> {
4470 self.next.clone()
4471 }
4472
4473 fn next_page(
4474 &self,
4475 req: reqwest::Request,
4476 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
4477 let mut req = req.try_clone().ok_or_else(|| {
4478 crate::types::error::Error::InvalidRequest(format!(
4479 "failed to clone request: {req:?}"
4480 ))
4481 })?;
4482 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
4483 crate::types::error::Error::InvalidRequest(format!(
4484 "failed to parse url: {:?}",
4485 self.next
4486 ))
4487 })?;
4488 Ok(req)
4489 }
4490
4491 fn items(&self) -> Vec<Self::Item> {
4492 self.results.clone()
4493 }
4494}
4495
4496#[cfg(feature = "tabled")]
4497impl tabled::Tabled for PaginatedCustomFieldList {
4498 const LENGTH: usize = 5;
4499 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4500 vec![
4501 format!("{:?}", self.count).into(),
4502 if let Some(next) = &self.next {
4503 format!("{next:?}").into()
4504 } else {
4505 String::new().into()
4506 },
4507 if let Some(previous) = &self.previous {
4508 format!("{previous:?}").into()
4509 } else {
4510 String::new().into()
4511 },
4512 format!("{:?}", self.results).into(),
4513 if let Some(all) = &self.all {
4514 format!("{all:?}").into()
4515 } else {
4516 String::new().into()
4517 },
4518 ]
4519 }
4520
4521 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4522 vec![
4523 "count".into(),
4524 "next".into(),
4525 "previous".into(),
4526 "results".into(),
4527 "all".into(),
4528 ]
4529 }
4530}
4531
4532#[derive(
4533 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4534)]
4535#[allow(non_snake_case)]
4536pub struct PaginatedDocumentList {
4537 pub count: i64,
4538 #[serde(default, skip_serializing_if = "Option::is_none")]
4539 pub next: Option<String>,
4540 #[serde(default, skip_serializing_if = "Option::is_none")]
4541 pub previous: Option<String>,
4542 pub results: Vec<Document>,
4543 #[serde(default, skip_serializing_if = "Option::is_none")]
4544 pub all: Option<Vec<i64>>,
4545}
4546
4547impl std::fmt::Display for PaginatedDocumentList {
4548 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4549 write!(
4550 f,
4551 "{}",
4552 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4553 )
4554 }
4555}
4556
4557#[cfg(feature = "requests")]
4558impl crate::types::paginate::Pagination for PaginatedDocumentList {
4559 type Item = Document;
4560 fn has_more_pages(&self) -> bool {
4561 self.next.is_some()
4562 }
4563
4564 fn next_page_token(&self) -> Option<String> {
4565 self.next.clone()
4566 }
4567
4568 fn next_page(
4569 &self,
4570 req: reqwest::Request,
4571 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
4572 let mut req = req.try_clone().ok_or_else(|| {
4573 crate::types::error::Error::InvalidRequest(format!(
4574 "failed to clone request: {req:?}"
4575 ))
4576 })?;
4577 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
4578 crate::types::error::Error::InvalidRequest(format!(
4579 "failed to parse url: {:?}",
4580 self.next
4581 ))
4582 })?;
4583 Ok(req)
4584 }
4585
4586 fn items(&self) -> Vec<Self::Item> {
4587 self.results.clone()
4588 }
4589}
4590
4591#[cfg(feature = "tabled")]
4592impl tabled::Tabled for PaginatedDocumentList {
4593 const LENGTH: usize = 5;
4594 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4595 vec![
4596 format!("{:?}", self.count).into(),
4597 if let Some(next) = &self.next {
4598 format!("{next:?}").into()
4599 } else {
4600 String::new().into()
4601 },
4602 if let Some(previous) = &self.previous {
4603 format!("{previous:?}").into()
4604 } else {
4605 String::new().into()
4606 },
4607 format!("{:?}", self.results).into(),
4608 if let Some(all) = &self.all {
4609 format!("{all:?}").into()
4610 } else {
4611 String::new().into()
4612 },
4613 ]
4614 }
4615
4616 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4617 vec![
4618 "count".into(),
4619 "next".into(),
4620 "previous".into(),
4621 "results".into(),
4622 "all".into(),
4623 ]
4624 }
4625}
4626
4627#[derive(
4628 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4629)]
4630#[allow(non_snake_case)]
4631pub struct PaginatedDocumentTypeList {
4632 pub count: i64,
4633 #[serde(default, skip_serializing_if = "Option::is_none")]
4634 pub next: Option<String>,
4635 #[serde(default, skip_serializing_if = "Option::is_none")]
4636 pub previous: Option<String>,
4637 pub results: Vec<DocumentType>,
4638 #[serde(default, skip_serializing_if = "Option::is_none")]
4639 pub all: Option<Vec<i64>>,
4640}
4641
4642impl std::fmt::Display for PaginatedDocumentTypeList {
4643 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4644 write!(
4645 f,
4646 "{}",
4647 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4648 )
4649 }
4650}
4651
4652#[cfg(feature = "requests")]
4653impl crate::types::paginate::Pagination for PaginatedDocumentTypeList {
4654 type Item = DocumentType;
4655 fn has_more_pages(&self) -> bool {
4656 self.next.is_some()
4657 }
4658
4659 fn next_page_token(&self) -> Option<String> {
4660 self.next.clone()
4661 }
4662
4663 fn next_page(
4664 &self,
4665 req: reqwest::Request,
4666 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
4667 let mut req = req.try_clone().ok_or_else(|| {
4668 crate::types::error::Error::InvalidRequest(format!(
4669 "failed to clone request: {req:?}"
4670 ))
4671 })?;
4672 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
4673 crate::types::error::Error::InvalidRequest(format!(
4674 "failed to parse url: {:?}",
4675 self.next
4676 ))
4677 })?;
4678 Ok(req)
4679 }
4680
4681 fn items(&self) -> Vec<Self::Item> {
4682 self.results.clone()
4683 }
4684}
4685
4686#[cfg(feature = "tabled")]
4687impl tabled::Tabled for PaginatedDocumentTypeList {
4688 const LENGTH: usize = 5;
4689 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4690 vec![
4691 format!("{:?}", self.count).into(),
4692 if let Some(next) = &self.next {
4693 format!("{next:?}").into()
4694 } else {
4695 String::new().into()
4696 },
4697 if let Some(previous) = &self.previous {
4698 format!("{previous:?}").into()
4699 } else {
4700 String::new().into()
4701 },
4702 format!("{:?}", self.results).into(),
4703 if let Some(all) = &self.all {
4704 format!("{all:?}").into()
4705 } else {
4706 String::new().into()
4707 },
4708 ]
4709 }
4710
4711 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4712 vec![
4713 "count".into(),
4714 "next".into(),
4715 "previous".into(),
4716 "results".into(),
4717 "all".into(),
4718 ]
4719 }
4720}
4721
4722#[derive(
4723 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4724)]
4725#[allow(non_snake_case)]
4726pub struct PaginatedGroupList {
4727 pub count: i64,
4728 #[serde(default, skip_serializing_if = "Option::is_none")]
4729 pub next: Option<String>,
4730 #[serde(default, skip_serializing_if = "Option::is_none")]
4731 pub previous: Option<String>,
4732 pub results: Vec<Group>,
4733 #[serde(default, skip_serializing_if = "Option::is_none")]
4734 pub all: Option<Vec<i64>>,
4735}
4736
4737impl std::fmt::Display for PaginatedGroupList {
4738 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4739 write!(
4740 f,
4741 "{}",
4742 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4743 )
4744 }
4745}
4746
4747#[cfg(feature = "requests")]
4748impl crate::types::paginate::Pagination for PaginatedGroupList {
4749 type Item = Group;
4750 fn has_more_pages(&self) -> bool {
4751 self.next.is_some()
4752 }
4753
4754 fn next_page_token(&self) -> Option<String> {
4755 self.next.clone()
4756 }
4757
4758 fn next_page(
4759 &self,
4760 req: reqwest::Request,
4761 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
4762 let mut req = req.try_clone().ok_or_else(|| {
4763 crate::types::error::Error::InvalidRequest(format!(
4764 "failed to clone request: {req:?}"
4765 ))
4766 })?;
4767 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
4768 crate::types::error::Error::InvalidRequest(format!(
4769 "failed to parse url: {:?}",
4770 self.next
4771 ))
4772 })?;
4773 Ok(req)
4774 }
4775
4776 fn items(&self) -> Vec<Self::Item> {
4777 self.results.clone()
4778 }
4779}
4780
4781#[cfg(feature = "tabled")]
4782impl tabled::Tabled for PaginatedGroupList {
4783 const LENGTH: usize = 5;
4784 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4785 vec![
4786 format!("{:?}", self.count).into(),
4787 if let Some(next) = &self.next {
4788 format!("{next:?}").into()
4789 } else {
4790 String::new().into()
4791 },
4792 if let Some(previous) = &self.previous {
4793 format!("{previous:?}").into()
4794 } else {
4795 String::new().into()
4796 },
4797 format!("{:?}", self.results).into(),
4798 if let Some(all) = &self.all {
4799 format!("{all:?}").into()
4800 } else {
4801 String::new().into()
4802 },
4803 ]
4804 }
4805
4806 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4807 vec![
4808 "count".into(),
4809 "next".into(),
4810 "previous".into(),
4811 "results".into(),
4812 "all".into(),
4813 ]
4814 }
4815}
4816
4817#[derive(
4818 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4819)]
4820#[allow(non_snake_case)]
4821pub struct PaginatedLogEntryList {
4822 pub count: i64,
4823 #[serde(default, skip_serializing_if = "Option::is_none")]
4824 pub next: Option<String>,
4825 #[serde(default, skip_serializing_if = "Option::is_none")]
4826 pub previous: Option<String>,
4827 pub results: Vec<LogEntry>,
4828 #[serde(default, skip_serializing_if = "Option::is_none")]
4829 pub all: Option<Vec<i64>>,
4830}
4831
4832impl std::fmt::Display for PaginatedLogEntryList {
4833 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4834 write!(
4835 f,
4836 "{}",
4837 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4838 )
4839 }
4840}
4841
4842#[cfg(feature = "requests")]
4843impl crate::types::paginate::Pagination for PaginatedLogEntryList {
4844 type Item = LogEntry;
4845 fn has_more_pages(&self) -> bool {
4846 self.next.is_some()
4847 }
4848
4849 fn next_page_token(&self) -> Option<String> {
4850 self.next.clone()
4851 }
4852
4853 fn next_page(
4854 &self,
4855 req: reqwest::Request,
4856 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
4857 let mut req = req.try_clone().ok_or_else(|| {
4858 crate::types::error::Error::InvalidRequest(format!(
4859 "failed to clone request: {req:?}"
4860 ))
4861 })?;
4862 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
4863 crate::types::error::Error::InvalidRequest(format!(
4864 "failed to parse url: {:?}",
4865 self.next
4866 ))
4867 })?;
4868 Ok(req)
4869 }
4870
4871 fn items(&self) -> Vec<Self::Item> {
4872 self.results.clone()
4873 }
4874}
4875
4876#[cfg(feature = "tabled")]
4877impl tabled::Tabled for PaginatedLogEntryList {
4878 const LENGTH: usize = 5;
4879 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4880 vec![
4881 format!("{:?}", self.count).into(),
4882 if let Some(next) = &self.next {
4883 format!("{next:?}").into()
4884 } else {
4885 String::new().into()
4886 },
4887 if let Some(previous) = &self.previous {
4888 format!("{previous:?}").into()
4889 } else {
4890 String::new().into()
4891 },
4892 format!("{:?}", self.results).into(),
4893 if let Some(all) = &self.all {
4894 format!("{all:?}").into()
4895 } else {
4896 String::new().into()
4897 },
4898 ]
4899 }
4900
4901 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4902 vec![
4903 "count".into(),
4904 "next".into(),
4905 "previous".into(),
4906 "results".into(),
4907 "all".into(),
4908 ]
4909 }
4910}
4911
4912#[derive(
4913 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
4914)]
4915#[allow(non_snake_case)]
4916pub struct PaginatedMailAccountList {
4917 pub count: i64,
4918 #[serde(default, skip_serializing_if = "Option::is_none")]
4919 pub next: Option<String>,
4920 #[serde(default, skip_serializing_if = "Option::is_none")]
4921 pub previous: Option<String>,
4922 pub results: Vec<MailAccount>,
4923 #[serde(default, skip_serializing_if = "Option::is_none")]
4924 pub all: Option<Vec<i64>>,
4925}
4926
4927impl std::fmt::Display for PaginatedMailAccountList {
4928 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
4929 write!(
4930 f,
4931 "{}",
4932 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
4933 )
4934 }
4935}
4936
4937#[cfg(feature = "requests")]
4938impl crate::types::paginate::Pagination for PaginatedMailAccountList {
4939 type Item = MailAccount;
4940 fn has_more_pages(&self) -> bool {
4941 self.next.is_some()
4942 }
4943
4944 fn next_page_token(&self) -> Option<String> {
4945 self.next.clone()
4946 }
4947
4948 fn next_page(
4949 &self,
4950 req: reqwest::Request,
4951 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
4952 let mut req = req.try_clone().ok_or_else(|| {
4953 crate::types::error::Error::InvalidRequest(format!(
4954 "failed to clone request: {req:?}"
4955 ))
4956 })?;
4957 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
4958 crate::types::error::Error::InvalidRequest(format!(
4959 "failed to parse url: {:?}",
4960 self.next
4961 ))
4962 })?;
4963 Ok(req)
4964 }
4965
4966 fn items(&self) -> Vec<Self::Item> {
4967 self.results.clone()
4968 }
4969}
4970
4971#[cfg(feature = "tabled")]
4972impl tabled::Tabled for PaginatedMailAccountList {
4973 const LENGTH: usize = 5;
4974 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
4975 vec![
4976 format!("{:?}", self.count).into(),
4977 if let Some(next) = &self.next {
4978 format!("{next:?}").into()
4979 } else {
4980 String::new().into()
4981 },
4982 if let Some(previous) = &self.previous {
4983 format!("{previous:?}").into()
4984 } else {
4985 String::new().into()
4986 },
4987 format!("{:?}", self.results).into(),
4988 if let Some(all) = &self.all {
4989 format!("{all:?}").into()
4990 } else {
4991 String::new().into()
4992 },
4993 ]
4994 }
4995
4996 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
4997 vec![
4998 "count".into(),
4999 "next".into(),
5000 "previous".into(),
5001 "results".into(),
5002 "all".into(),
5003 ]
5004 }
5005}
5006
5007#[derive(
5008 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5009)]
5010#[allow(non_snake_case)]
5011pub struct PaginatedMailRuleList {
5012 pub count: i64,
5013 #[serde(default, skip_serializing_if = "Option::is_none")]
5014 pub next: Option<String>,
5015 #[serde(default, skip_serializing_if = "Option::is_none")]
5016 pub previous: Option<String>,
5017 pub results: Vec<MailRule>,
5018 #[serde(default, skip_serializing_if = "Option::is_none")]
5019 pub all: Option<Vec<i64>>,
5020}
5021
5022impl std::fmt::Display for PaginatedMailRuleList {
5023 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5024 write!(
5025 f,
5026 "{}",
5027 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5028 )
5029 }
5030}
5031
5032#[cfg(feature = "requests")]
5033impl crate::types::paginate::Pagination for PaginatedMailRuleList {
5034 type Item = MailRule;
5035 fn has_more_pages(&self) -> bool {
5036 self.next.is_some()
5037 }
5038
5039 fn next_page_token(&self) -> Option<String> {
5040 self.next.clone()
5041 }
5042
5043 fn next_page(
5044 &self,
5045 req: reqwest::Request,
5046 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5047 let mut req = req.try_clone().ok_or_else(|| {
5048 crate::types::error::Error::InvalidRequest(format!(
5049 "failed to clone request: {req:?}"
5050 ))
5051 })?;
5052 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5053 crate::types::error::Error::InvalidRequest(format!(
5054 "failed to parse url: {:?}",
5055 self.next
5056 ))
5057 })?;
5058 Ok(req)
5059 }
5060
5061 fn items(&self) -> Vec<Self::Item> {
5062 self.results.clone()
5063 }
5064}
5065
5066#[cfg(feature = "tabled")]
5067impl tabled::Tabled for PaginatedMailRuleList {
5068 const LENGTH: usize = 5;
5069 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5070 vec![
5071 format!("{:?}", self.count).into(),
5072 if let Some(next) = &self.next {
5073 format!("{next:?}").into()
5074 } else {
5075 String::new().into()
5076 },
5077 if let Some(previous) = &self.previous {
5078 format!("{previous:?}").into()
5079 } else {
5080 String::new().into()
5081 },
5082 format!("{:?}", self.results).into(),
5083 if let Some(all) = &self.all {
5084 format!("{all:?}").into()
5085 } else {
5086 String::new().into()
5087 },
5088 ]
5089 }
5090
5091 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5092 vec![
5093 "count".into(),
5094 "next".into(),
5095 "previous".into(),
5096 "results".into(),
5097 "all".into(),
5098 ]
5099 }
5100}
5101
5102#[derive(
5103 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5104)]
5105#[allow(non_snake_case)]
5106pub struct PaginatedNotesList {
5107 pub count: i64,
5108 #[serde(default, skip_serializing_if = "Option::is_none")]
5109 pub next: Option<String>,
5110 #[serde(default, skip_serializing_if = "Option::is_none")]
5111 pub previous: Option<String>,
5112 pub results: Vec<Notes>,
5113 #[serde(default, skip_serializing_if = "Option::is_none")]
5114 pub all: Option<Vec<i64>>,
5115}
5116
5117impl std::fmt::Display for PaginatedNotesList {
5118 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5119 write!(
5120 f,
5121 "{}",
5122 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5123 )
5124 }
5125}
5126
5127#[cfg(feature = "requests")]
5128impl crate::types::paginate::Pagination for PaginatedNotesList {
5129 type Item = Notes;
5130 fn has_more_pages(&self) -> bool {
5131 self.next.is_some()
5132 }
5133
5134 fn next_page_token(&self) -> Option<String> {
5135 self.next.clone()
5136 }
5137
5138 fn next_page(
5139 &self,
5140 req: reqwest::Request,
5141 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5142 let mut req = req.try_clone().ok_or_else(|| {
5143 crate::types::error::Error::InvalidRequest(format!(
5144 "failed to clone request: {req:?}"
5145 ))
5146 })?;
5147 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5148 crate::types::error::Error::InvalidRequest(format!(
5149 "failed to parse url: {:?}",
5150 self.next
5151 ))
5152 })?;
5153 Ok(req)
5154 }
5155
5156 fn items(&self) -> Vec<Self::Item> {
5157 self.results.clone()
5158 }
5159}
5160
5161#[cfg(feature = "tabled")]
5162impl tabled::Tabled for PaginatedNotesList {
5163 const LENGTH: usize = 5;
5164 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5165 vec![
5166 format!("{:?}", self.count).into(),
5167 if let Some(next) = &self.next {
5168 format!("{next:?}").into()
5169 } else {
5170 String::new().into()
5171 },
5172 if let Some(previous) = &self.previous {
5173 format!("{previous:?}").into()
5174 } else {
5175 String::new().into()
5176 },
5177 format!("{:?}", self.results).into(),
5178 if let Some(all) = &self.all {
5179 format!("{all:?}").into()
5180 } else {
5181 String::new().into()
5182 },
5183 ]
5184 }
5185
5186 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5187 vec![
5188 "count".into(),
5189 "next".into(),
5190 "previous".into(),
5191 "results".into(),
5192 "all".into(),
5193 ]
5194 }
5195}
5196
5197#[derive(
5198 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5199)]
5200#[allow(non_snake_case)]
5201pub struct PaginatedSavedViewList {
5202 pub count: i64,
5203 #[serde(default, skip_serializing_if = "Option::is_none")]
5204 pub next: Option<String>,
5205 #[serde(default, skip_serializing_if = "Option::is_none")]
5206 pub previous: Option<String>,
5207 pub results: Vec<SavedView>,
5208 #[serde(default, skip_serializing_if = "Option::is_none")]
5209 pub all: Option<Vec<i64>>,
5210}
5211
5212impl std::fmt::Display for PaginatedSavedViewList {
5213 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5214 write!(
5215 f,
5216 "{}",
5217 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5218 )
5219 }
5220}
5221
5222#[cfg(feature = "requests")]
5223impl crate::types::paginate::Pagination for PaginatedSavedViewList {
5224 type Item = SavedView;
5225 fn has_more_pages(&self) -> bool {
5226 self.next.is_some()
5227 }
5228
5229 fn next_page_token(&self) -> Option<String> {
5230 self.next.clone()
5231 }
5232
5233 fn next_page(
5234 &self,
5235 req: reqwest::Request,
5236 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5237 let mut req = req.try_clone().ok_or_else(|| {
5238 crate::types::error::Error::InvalidRequest(format!(
5239 "failed to clone request: {req:?}"
5240 ))
5241 })?;
5242 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5243 crate::types::error::Error::InvalidRequest(format!(
5244 "failed to parse url: {:?}",
5245 self.next
5246 ))
5247 })?;
5248 Ok(req)
5249 }
5250
5251 fn items(&self) -> Vec<Self::Item> {
5252 self.results.clone()
5253 }
5254}
5255
5256#[cfg(feature = "tabled")]
5257impl tabled::Tabled for PaginatedSavedViewList {
5258 const LENGTH: usize = 5;
5259 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5260 vec![
5261 format!("{:?}", self.count).into(),
5262 if let Some(next) = &self.next {
5263 format!("{next:?}").into()
5264 } else {
5265 String::new().into()
5266 },
5267 if let Some(previous) = &self.previous {
5268 format!("{previous:?}").into()
5269 } else {
5270 String::new().into()
5271 },
5272 format!("{:?}", self.results).into(),
5273 if let Some(all) = &self.all {
5274 format!("{all:?}").into()
5275 } else {
5276 String::new().into()
5277 },
5278 ]
5279 }
5280
5281 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5282 vec![
5283 "count".into(),
5284 "next".into(),
5285 "previous".into(),
5286 "results".into(),
5287 "all".into(),
5288 ]
5289 }
5290}
5291
5292#[derive(
5293 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5294)]
5295#[allow(non_snake_case)]
5296pub struct PaginatedShareLinkList {
5297 pub count: i64,
5298 #[serde(default, skip_serializing_if = "Option::is_none")]
5299 pub next: Option<String>,
5300 #[serde(default, skip_serializing_if = "Option::is_none")]
5301 pub previous: Option<String>,
5302 pub results: Vec<ShareLink>,
5303 #[serde(default, skip_serializing_if = "Option::is_none")]
5304 pub all: Option<Vec<i64>>,
5305}
5306
5307impl std::fmt::Display for PaginatedShareLinkList {
5308 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5309 write!(
5310 f,
5311 "{}",
5312 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5313 )
5314 }
5315}
5316
5317#[cfg(feature = "requests")]
5318impl crate::types::paginate::Pagination for PaginatedShareLinkList {
5319 type Item = ShareLink;
5320 fn has_more_pages(&self) -> bool {
5321 self.next.is_some()
5322 }
5323
5324 fn next_page_token(&self) -> Option<String> {
5325 self.next.clone()
5326 }
5327
5328 fn next_page(
5329 &self,
5330 req: reqwest::Request,
5331 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5332 let mut req = req.try_clone().ok_or_else(|| {
5333 crate::types::error::Error::InvalidRequest(format!(
5334 "failed to clone request: {req:?}"
5335 ))
5336 })?;
5337 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5338 crate::types::error::Error::InvalidRequest(format!(
5339 "failed to parse url: {:?}",
5340 self.next
5341 ))
5342 })?;
5343 Ok(req)
5344 }
5345
5346 fn items(&self) -> Vec<Self::Item> {
5347 self.results.clone()
5348 }
5349}
5350
5351#[cfg(feature = "tabled")]
5352impl tabled::Tabled for PaginatedShareLinkList {
5353 const LENGTH: usize = 5;
5354 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5355 vec![
5356 format!("{:?}", self.count).into(),
5357 if let Some(next) = &self.next {
5358 format!("{next:?}").into()
5359 } else {
5360 String::new().into()
5361 },
5362 if let Some(previous) = &self.previous {
5363 format!("{previous:?}").into()
5364 } else {
5365 String::new().into()
5366 },
5367 format!("{:?}", self.results).into(),
5368 if let Some(all) = &self.all {
5369 format!("{all:?}").into()
5370 } else {
5371 String::new().into()
5372 },
5373 ]
5374 }
5375
5376 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5377 vec![
5378 "count".into(),
5379 "next".into(),
5380 "previous".into(),
5381 "results".into(),
5382 "all".into(),
5383 ]
5384 }
5385}
5386
5387#[derive(
5388 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5389)]
5390#[allow(non_snake_case)]
5391pub struct PaginatedStoragePathList {
5392 pub count: i64,
5393 #[serde(default, skip_serializing_if = "Option::is_none")]
5394 pub next: Option<String>,
5395 #[serde(default, skip_serializing_if = "Option::is_none")]
5396 pub previous: Option<String>,
5397 pub results: Vec<StoragePath>,
5398 #[serde(default, skip_serializing_if = "Option::is_none")]
5399 pub all: Option<Vec<i64>>,
5400}
5401
5402impl std::fmt::Display for PaginatedStoragePathList {
5403 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5404 write!(
5405 f,
5406 "{}",
5407 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5408 )
5409 }
5410}
5411
5412#[cfg(feature = "requests")]
5413impl crate::types::paginate::Pagination for PaginatedStoragePathList {
5414 type Item = StoragePath;
5415 fn has_more_pages(&self) -> bool {
5416 self.next.is_some()
5417 }
5418
5419 fn next_page_token(&self) -> Option<String> {
5420 self.next.clone()
5421 }
5422
5423 fn next_page(
5424 &self,
5425 req: reqwest::Request,
5426 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5427 let mut req = req.try_clone().ok_or_else(|| {
5428 crate::types::error::Error::InvalidRequest(format!(
5429 "failed to clone request: {req:?}"
5430 ))
5431 })?;
5432 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5433 crate::types::error::Error::InvalidRequest(format!(
5434 "failed to parse url: {:?}",
5435 self.next
5436 ))
5437 })?;
5438 Ok(req)
5439 }
5440
5441 fn items(&self) -> Vec<Self::Item> {
5442 self.results.clone()
5443 }
5444}
5445
5446#[cfg(feature = "tabled")]
5447impl tabled::Tabled for PaginatedStoragePathList {
5448 const LENGTH: usize = 5;
5449 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5450 vec![
5451 format!("{:?}", self.count).into(),
5452 if let Some(next) = &self.next {
5453 format!("{next:?}").into()
5454 } else {
5455 String::new().into()
5456 },
5457 if let Some(previous) = &self.previous {
5458 format!("{previous:?}").into()
5459 } else {
5460 String::new().into()
5461 },
5462 format!("{:?}", self.results).into(),
5463 if let Some(all) = &self.all {
5464 format!("{all:?}").into()
5465 } else {
5466 String::new().into()
5467 },
5468 ]
5469 }
5470
5471 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5472 vec![
5473 "count".into(),
5474 "next".into(),
5475 "previous".into(),
5476 "results".into(),
5477 "all".into(),
5478 ]
5479 }
5480}
5481
5482#[derive(
5483 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5484)]
5485#[allow(non_snake_case)]
5486pub struct PaginatedTagList {
5487 pub count: i64,
5488 #[serde(default, skip_serializing_if = "Option::is_none")]
5489 pub next: Option<String>,
5490 #[serde(default, skip_serializing_if = "Option::is_none")]
5491 pub previous: Option<String>,
5492 pub results: Vec<Tag>,
5493 #[serde(default, skip_serializing_if = "Option::is_none")]
5494 pub all: Option<Vec<i64>>,
5495}
5496
5497impl std::fmt::Display for PaginatedTagList {
5498 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5499 write!(
5500 f,
5501 "{}",
5502 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5503 )
5504 }
5505}
5506
5507#[cfg(feature = "requests")]
5508impl crate::types::paginate::Pagination for PaginatedTagList {
5509 type Item = Tag;
5510 fn has_more_pages(&self) -> bool {
5511 self.next.is_some()
5512 }
5513
5514 fn next_page_token(&self) -> Option<String> {
5515 self.next.clone()
5516 }
5517
5518 fn next_page(
5519 &self,
5520 req: reqwest::Request,
5521 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5522 let mut req = req.try_clone().ok_or_else(|| {
5523 crate::types::error::Error::InvalidRequest(format!(
5524 "failed to clone request: {req:?}"
5525 ))
5526 })?;
5527 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5528 crate::types::error::Error::InvalidRequest(format!(
5529 "failed to parse url: {:?}",
5530 self.next
5531 ))
5532 })?;
5533 Ok(req)
5534 }
5535
5536 fn items(&self) -> Vec<Self::Item> {
5537 self.results.clone()
5538 }
5539}
5540
5541#[cfg(feature = "tabled")]
5542impl tabled::Tabled for PaginatedTagList {
5543 const LENGTH: usize = 5;
5544 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5545 vec![
5546 format!("{:?}", self.count).into(),
5547 if let Some(next) = &self.next {
5548 format!("{next:?}").into()
5549 } else {
5550 String::new().into()
5551 },
5552 if let Some(previous) = &self.previous {
5553 format!("{previous:?}").into()
5554 } else {
5555 String::new().into()
5556 },
5557 format!("{:?}", self.results).into(),
5558 if let Some(all) = &self.all {
5559 format!("{all:?}").into()
5560 } else {
5561 String::new().into()
5562 },
5563 ]
5564 }
5565
5566 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5567 vec![
5568 "count".into(),
5569 "next".into(),
5570 "previous".into(),
5571 "results".into(),
5572 "all".into(),
5573 ]
5574 }
5575}
5576
5577#[derive(
5578 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5579)]
5580#[allow(non_snake_case)]
5581pub struct PaginatedUserList {
5582 pub count: i64,
5583 #[serde(default, skip_serializing_if = "Option::is_none")]
5584 pub next: Option<String>,
5585 #[serde(default, skip_serializing_if = "Option::is_none")]
5586 pub previous: Option<String>,
5587 pub results: Vec<User>,
5588 #[serde(default, skip_serializing_if = "Option::is_none")]
5589 pub all: Option<Vec<i64>>,
5590}
5591
5592impl std::fmt::Display for PaginatedUserList {
5593 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5594 write!(
5595 f,
5596 "{}",
5597 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5598 )
5599 }
5600}
5601
5602#[cfg(feature = "requests")]
5603impl crate::types::paginate::Pagination for PaginatedUserList {
5604 type Item = User;
5605 fn has_more_pages(&self) -> bool {
5606 self.next.is_some()
5607 }
5608
5609 fn next_page_token(&self) -> Option<String> {
5610 self.next.clone()
5611 }
5612
5613 fn next_page(
5614 &self,
5615 req: reqwest::Request,
5616 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5617 let mut req = req.try_clone().ok_or_else(|| {
5618 crate::types::error::Error::InvalidRequest(format!(
5619 "failed to clone request: {req:?}"
5620 ))
5621 })?;
5622 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5623 crate::types::error::Error::InvalidRequest(format!(
5624 "failed to parse url: {:?}",
5625 self.next
5626 ))
5627 })?;
5628 Ok(req)
5629 }
5630
5631 fn items(&self) -> Vec<Self::Item> {
5632 self.results.clone()
5633 }
5634}
5635
5636#[cfg(feature = "tabled")]
5637impl tabled::Tabled for PaginatedUserList {
5638 const LENGTH: usize = 5;
5639 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5640 vec![
5641 format!("{:?}", self.count).into(),
5642 if let Some(next) = &self.next {
5643 format!("{next:?}").into()
5644 } else {
5645 String::new().into()
5646 },
5647 if let Some(previous) = &self.previous {
5648 format!("{previous:?}").into()
5649 } else {
5650 String::new().into()
5651 },
5652 format!("{:?}", self.results).into(),
5653 if let Some(all) = &self.all {
5654 format!("{all:?}").into()
5655 } else {
5656 String::new().into()
5657 },
5658 ]
5659 }
5660
5661 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5662 vec![
5663 "count".into(),
5664 "next".into(),
5665 "previous".into(),
5666 "results".into(),
5667 "all".into(),
5668 ]
5669 }
5670}
5671
5672#[derive(
5673 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5674)]
5675#[allow(non_snake_case)]
5676pub struct PaginatedWorkflowActionList {
5677 pub count: i64,
5678 #[serde(default, skip_serializing_if = "Option::is_none")]
5679 pub next: Option<String>,
5680 #[serde(default, skip_serializing_if = "Option::is_none")]
5681 pub previous: Option<String>,
5682 pub results: Vec<WorkflowAction>,
5683 #[serde(default, skip_serializing_if = "Option::is_none")]
5684 pub all: Option<Vec<i64>>,
5685}
5686
5687impl std::fmt::Display for PaginatedWorkflowActionList {
5688 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5689 write!(
5690 f,
5691 "{}",
5692 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5693 )
5694 }
5695}
5696
5697#[cfg(feature = "requests")]
5698impl crate::types::paginate::Pagination for PaginatedWorkflowActionList {
5699 type Item = WorkflowAction;
5700 fn has_more_pages(&self) -> bool {
5701 self.next.is_some()
5702 }
5703
5704 fn next_page_token(&self) -> Option<String> {
5705 self.next.clone()
5706 }
5707
5708 fn next_page(
5709 &self,
5710 req: reqwest::Request,
5711 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5712 let mut req = req.try_clone().ok_or_else(|| {
5713 crate::types::error::Error::InvalidRequest(format!(
5714 "failed to clone request: {req:?}"
5715 ))
5716 })?;
5717 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5718 crate::types::error::Error::InvalidRequest(format!(
5719 "failed to parse url: {:?}",
5720 self.next
5721 ))
5722 })?;
5723 Ok(req)
5724 }
5725
5726 fn items(&self) -> Vec<Self::Item> {
5727 self.results.clone()
5728 }
5729}
5730
5731#[cfg(feature = "tabled")]
5732impl tabled::Tabled for PaginatedWorkflowActionList {
5733 const LENGTH: usize = 5;
5734 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5735 vec![
5736 format!("{:?}", self.count).into(),
5737 if let Some(next) = &self.next {
5738 format!("{next:?}").into()
5739 } else {
5740 String::new().into()
5741 },
5742 if let Some(previous) = &self.previous {
5743 format!("{previous:?}").into()
5744 } else {
5745 String::new().into()
5746 },
5747 format!("{:?}", self.results).into(),
5748 if let Some(all) = &self.all {
5749 format!("{all:?}").into()
5750 } else {
5751 String::new().into()
5752 },
5753 ]
5754 }
5755
5756 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5757 vec![
5758 "count".into(),
5759 "next".into(),
5760 "previous".into(),
5761 "results".into(),
5762 "all".into(),
5763 ]
5764 }
5765}
5766
5767#[derive(
5768 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5769)]
5770#[allow(non_snake_case)]
5771pub struct PaginatedWorkflowList {
5772 pub count: i64,
5773 #[serde(default, skip_serializing_if = "Option::is_none")]
5774 pub next: Option<String>,
5775 #[serde(default, skip_serializing_if = "Option::is_none")]
5776 pub previous: Option<String>,
5777 pub results: Vec<Workflow>,
5778 #[serde(default, skip_serializing_if = "Option::is_none")]
5779 pub all: Option<Vec<i64>>,
5780}
5781
5782impl std::fmt::Display for PaginatedWorkflowList {
5783 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5784 write!(
5785 f,
5786 "{}",
5787 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5788 )
5789 }
5790}
5791
5792#[cfg(feature = "requests")]
5793impl crate::types::paginate::Pagination for PaginatedWorkflowList {
5794 type Item = Workflow;
5795 fn has_more_pages(&self) -> bool {
5796 self.next.is_some()
5797 }
5798
5799 fn next_page_token(&self) -> Option<String> {
5800 self.next.clone()
5801 }
5802
5803 fn next_page(
5804 &self,
5805 req: reqwest::Request,
5806 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5807 let mut req = req.try_clone().ok_or_else(|| {
5808 crate::types::error::Error::InvalidRequest(format!(
5809 "failed to clone request: {req:?}"
5810 ))
5811 })?;
5812 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5813 crate::types::error::Error::InvalidRequest(format!(
5814 "failed to parse url: {:?}",
5815 self.next
5816 ))
5817 })?;
5818 Ok(req)
5819 }
5820
5821 fn items(&self) -> Vec<Self::Item> {
5822 self.results.clone()
5823 }
5824}
5825
5826#[cfg(feature = "tabled")]
5827impl tabled::Tabled for PaginatedWorkflowList {
5828 const LENGTH: usize = 5;
5829 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5830 vec![
5831 format!("{:?}", self.count).into(),
5832 if let Some(next) = &self.next {
5833 format!("{next:?}").into()
5834 } else {
5835 String::new().into()
5836 },
5837 if let Some(previous) = &self.previous {
5838 format!("{previous:?}").into()
5839 } else {
5840 String::new().into()
5841 },
5842 format!("{:?}", self.results).into(),
5843 if let Some(all) = &self.all {
5844 format!("{all:?}").into()
5845 } else {
5846 String::new().into()
5847 },
5848 ]
5849 }
5850
5851 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5852 vec![
5853 "count".into(),
5854 "next".into(),
5855 "previous".into(),
5856 "results".into(),
5857 "all".into(),
5858 ]
5859 }
5860}
5861
5862#[derive(
5863 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5864)]
5865#[allow(non_snake_case)]
5866pub struct PaginatedWorkflowTriggerList {
5867 pub count: i64,
5868 #[serde(default, skip_serializing_if = "Option::is_none")]
5869 pub next: Option<String>,
5870 #[serde(default, skip_serializing_if = "Option::is_none")]
5871 pub previous: Option<String>,
5872 pub results: Vec<WorkflowTrigger>,
5873 #[serde(default, skip_serializing_if = "Option::is_none")]
5874 pub all: Option<Vec<i64>>,
5875}
5876
5877impl std::fmt::Display for PaginatedWorkflowTriggerList {
5878 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5879 write!(
5880 f,
5881 "{}",
5882 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5883 )
5884 }
5885}
5886
5887#[cfg(feature = "requests")]
5888impl crate::types::paginate::Pagination for PaginatedWorkflowTriggerList {
5889 type Item = WorkflowTrigger;
5890 fn has_more_pages(&self) -> bool {
5891 self.next.is_some()
5892 }
5893
5894 fn next_page_token(&self) -> Option<String> {
5895 self.next.clone()
5896 }
5897
5898 fn next_page(
5899 &self,
5900 req: reqwest::Request,
5901 ) -> anyhow::Result<reqwest::Request, crate::types::error::Error> {
5902 let mut req = req.try_clone().ok_or_else(|| {
5903 crate::types::error::Error::InvalidRequest(format!(
5904 "failed to clone request: {req:?}"
5905 ))
5906 })?;
5907 *req.url_mut() = url::Url::parse(self.next.as_deref().unwrap_or("")).map_err(|_| {
5908 crate::types::error::Error::InvalidRequest(format!(
5909 "failed to parse url: {:?}",
5910 self.next
5911 ))
5912 })?;
5913 Ok(req)
5914 }
5915
5916 fn items(&self) -> Vec<Self::Item> {
5917 self.results.clone()
5918 }
5919}
5920
5921#[cfg(feature = "tabled")]
5922impl tabled::Tabled for PaginatedWorkflowTriggerList {
5923 const LENGTH: usize = 5;
5924 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5925 vec![
5926 format!("{:?}", self.count).into(),
5927 if let Some(next) = &self.next {
5928 format!("{next:?}").into()
5929 } else {
5930 String::new().into()
5931 },
5932 if let Some(previous) = &self.previous {
5933 format!("{previous:?}").into()
5934 } else {
5935 String::new().into()
5936 },
5937 format!("{:?}", self.results).into(),
5938 if let Some(all) = &self.all {
5939 format!("{all:?}").into()
5940 } else {
5941 String::new().into()
5942 },
5943 ]
5944 }
5945
5946 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5947 vec![
5948 "count".into(),
5949 "next".into(),
5950 "previous".into(),
5951 "results".into(),
5952 "all".into(),
5953 ]
5954 }
5955}
5956
5957#[derive(
5958 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5959)]
5960#[allow(non_snake_case)]
5961pub struct PaperlessAuthToken {
5962 pub token: String,
5963}
5964
5965impl std::fmt::Display for PaperlessAuthToken {
5966 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
5967 write!(
5968 f,
5969 "{}",
5970 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
5971 )
5972 }
5973}
5974
5975#[cfg(feature = "tabled")]
5976impl tabled::Tabled for PaperlessAuthToken {
5977 const LENGTH: usize = 1;
5978 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
5979 vec![self.token.clone().into()]
5980 }
5981
5982 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
5983 vec!["token".into()]
5984 }
5985}
5986
5987#[derive(
5988 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
5989)]
5990#[allow(non_snake_case)]
5991pub struct PaperlessAuthTokenRequest {
5992 pub username: String,
5993 pub password: String,
5994 #[serde(default, skip_serializing_if = "Option::is_none")]
5995 pub code: Option<String>,
5996}
5997
5998impl std::fmt::Display for PaperlessAuthTokenRequest {
5999 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6000 write!(
6001 f,
6002 "{}",
6003 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6004 )
6005 }
6006}
6007
6008#[cfg(feature = "tabled")]
6009impl tabled::Tabled for PaperlessAuthTokenRequest {
6010 const LENGTH: usize = 3;
6011 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6012 vec![
6013 self.username.clone().into(),
6014 self.password.clone().into(),
6015 if let Some(code) = &self.code {
6016 format!("{code:?}").into()
6017 } else {
6018 String::new().into()
6019 },
6020 ]
6021 }
6022
6023 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
6024 vec!["username".into(), "password".into(), "code".into()]
6025 }
6026}
6027
6028#[derive(
6029 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
6030)]
6031#[allow(non_snake_case)]
6032pub struct PatchedApplicationConfigurationRequest {
6033 #[serde(default, skip_serializing_if = "Option::is_none")]
6034 pub user_args: Option<serde_json::Value>,
6035 #[serde(default, skip_serializing_if = "Option::is_none")]
6036 pub barcode_tag_mapping: Option<serde_json::Value>,
6037 #[serde(default, skip_serializing_if = "Option::is_none")]
6038 pub output_type: Option<OutputType>,
6039 #[serde(default, skip_serializing_if = "Option::is_none")]
6040 pub pages: Option<i64>,
6041 #[serde(default, skip_serializing_if = "Option::is_none")]
6042 pub language: Option<String>,
6043 #[serde(default, skip_serializing_if = "Option::is_none")]
6044 pub mode: Option<Mode>,
6045 #[serde(default, skip_serializing_if = "Option::is_none")]
6046 pub skip_archive_file: Option<SkipArchiveFile>,
6047 #[serde(default, skip_serializing_if = "Option::is_none")]
6048 pub image_dpi: Option<i64>,
6049 #[serde(default, skip_serializing_if = "Option::is_none")]
6050 pub unpaper_clean: Option<UnpaperClean>,
6051 #[serde(default, skip_serializing_if = "Option::is_none")]
6052 pub deskew: Option<bool>,
6053 #[serde(default, skip_serializing_if = "Option::is_none")]
6054 pub rotate_pages: Option<bool>,
6055 #[serde(default, skip_serializing_if = "Option::is_none")]
6056 pub rotate_pages_threshold: Option<f64>,
6057 #[serde(default, skip_serializing_if = "Option::is_none")]
6058 pub max_image_pixels: Option<f64>,
6059 #[serde(default, skip_serializing_if = "Option::is_none")]
6060 pub color_conversion_strategy: Option<ColorConversionStrategy>,
6061 #[serde(default, skip_serializing_if = "Option::is_none")]
6062 pub app_title: Option<String>,
6063 #[serde(default, skip_serializing_if = "Option::is_none")]
6064 pub app_logo: Option<bytes::Bytes>,
6065 #[serde(default, skip_serializing_if = "Option::is_none")]
6066 pub barcodes_enabled: Option<bool>,
6067 #[serde(default, skip_serializing_if = "Option::is_none")]
6068 pub barcode_enable_tiff_support: Option<bool>,
6069 #[serde(default, skip_serializing_if = "Option::is_none")]
6070 pub barcode_string: Option<String>,
6071 #[serde(default, skip_serializing_if = "Option::is_none")]
6072 pub barcode_retain_split_pages: Option<bool>,
6073 #[serde(default, skip_serializing_if = "Option::is_none")]
6074 pub barcode_enable_asn: Option<bool>,
6075 #[serde(default, skip_serializing_if = "Option::is_none")]
6076 pub barcode_asn_prefix: Option<String>,
6077 #[serde(default, skip_serializing_if = "Option::is_none")]
6078 pub barcode_upscale: Option<f64>,
6079 #[serde(default, skip_serializing_if = "Option::is_none")]
6080 pub barcode_dpi: Option<i64>,
6081 #[serde(default, skip_serializing_if = "Option::is_none")]
6082 pub barcode_max_pages: Option<i64>,
6083 #[serde(default, skip_serializing_if = "Option::is_none")]
6084 pub barcode_enable_tag: Option<bool>,
6085}
6086
6087impl std::fmt::Display for PatchedApplicationConfigurationRequest {
6088 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6089 write!(
6090 f,
6091 "{}",
6092 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6093 )
6094 }
6095}
6096
6097#[cfg(feature = "tabled")]
6098impl tabled::Tabled for PatchedApplicationConfigurationRequest {
6099 const LENGTH: usize = 26;
6100 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6101 vec![
6102 if let Some(user_args) = &self.user_args {
6103 format!("{user_args:?}").into()
6104 } else {
6105 String::new().into()
6106 },
6107 if let Some(barcode_tag_mapping) = &self.barcode_tag_mapping {
6108 format!("{barcode_tag_mapping:?}").into()
6109 } else {
6110 String::new().into()
6111 },
6112 if let Some(output_type) = &self.output_type {
6113 format!("{output_type:?}").into()
6114 } else {
6115 String::new().into()
6116 },
6117 if let Some(pages) = &self.pages {
6118 format!("{pages:?}").into()
6119 } else {
6120 String::new().into()
6121 },
6122 if let Some(language) = &self.language {
6123 format!("{language:?}").into()
6124 } else {
6125 String::new().into()
6126 },
6127 if let Some(mode) = &self.mode {
6128 format!("{mode:?}").into()
6129 } else {
6130 String::new().into()
6131 },
6132 if let Some(skip_archive_file) = &self.skip_archive_file {
6133 format!("{skip_archive_file:?}").into()
6134 } else {
6135 String::new().into()
6136 },
6137 if let Some(image_dpi) = &self.image_dpi {
6138 format!("{image_dpi:?}").into()
6139 } else {
6140 String::new().into()
6141 },
6142 if let Some(unpaper_clean) = &self.unpaper_clean {
6143 format!("{unpaper_clean:?}").into()
6144 } else {
6145 String::new().into()
6146 },
6147 if let Some(deskew) = &self.deskew {
6148 format!("{deskew:?}").into()
6149 } else {
6150 String::new().into()
6151 },
6152 if let Some(rotate_pages) = &self.rotate_pages {
6153 format!("{rotate_pages:?}").into()
6154 } else {
6155 String::new().into()
6156 },
6157 if let Some(rotate_pages_threshold) = &self.rotate_pages_threshold {
6158 format!("{rotate_pages_threshold:?}").into()
6159 } else {
6160 String::new().into()
6161 },
6162 if let Some(max_image_pixels) = &self.max_image_pixels {
6163 format!("{max_image_pixels:?}").into()
6164 } else {
6165 String::new().into()
6166 },
6167 if let Some(color_conversion_strategy) = &self.color_conversion_strategy {
6168 format!("{color_conversion_strategy:?}").into()
6169 } else {
6170 String::new().into()
6171 },
6172 if let Some(app_title) = &self.app_title {
6173 format!("{app_title:?}").into()
6174 } else {
6175 String::new().into()
6176 },
6177 if let Some(app_logo) = &self.app_logo {
6178 format!("{app_logo:?}").into()
6179 } else {
6180 String::new().into()
6181 },
6182 if let Some(barcodes_enabled) = &self.barcodes_enabled {
6183 format!("{barcodes_enabled:?}").into()
6184 } else {
6185 String::new().into()
6186 },
6187 if let Some(barcode_enable_tiff_support) = &self.barcode_enable_tiff_support {
6188 format!("{barcode_enable_tiff_support:?}").into()
6189 } else {
6190 String::new().into()
6191 },
6192 if let Some(barcode_string) = &self.barcode_string {
6193 format!("{barcode_string:?}").into()
6194 } else {
6195 String::new().into()
6196 },
6197 if let Some(barcode_retain_split_pages) = &self.barcode_retain_split_pages {
6198 format!("{barcode_retain_split_pages:?}").into()
6199 } else {
6200 String::new().into()
6201 },
6202 if let Some(barcode_enable_asn) = &self.barcode_enable_asn {
6203 format!("{barcode_enable_asn:?}").into()
6204 } else {
6205 String::new().into()
6206 },
6207 if let Some(barcode_asn_prefix) = &self.barcode_asn_prefix {
6208 format!("{barcode_asn_prefix:?}").into()
6209 } else {
6210 String::new().into()
6211 },
6212 if let Some(barcode_upscale) = &self.barcode_upscale {
6213 format!("{barcode_upscale:?}").into()
6214 } else {
6215 String::new().into()
6216 },
6217 if let Some(barcode_dpi) = &self.barcode_dpi {
6218 format!("{barcode_dpi:?}").into()
6219 } else {
6220 String::new().into()
6221 },
6222 if let Some(barcode_max_pages) = &self.barcode_max_pages {
6223 format!("{barcode_max_pages:?}").into()
6224 } else {
6225 String::new().into()
6226 },
6227 if let Some(barcode_enable_tag) = &self.barcode_enable_tag {
6228 format!("{barcode_enable_tag:?}").into()
6229 } else {
6230 String::new().into()
6231 },
6232 ]
6233 }
6234
6235 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
6236 vec![
6237 "user_args".into(),
6238 "barcode_tag_mapping".into(),
6239 "output_type".into(),
6240 "pages".into(),
6241 "language".into(),
6242 "mode".into(),
6243 "skip_archive_file".into(),
6244 "image_dpi".into(),
6245 "unpaper_clean".into(),
6246 "deskew".into(),
6247 "rotate_pages".into(),
6248 "rotate_pages_threshold".into(),
6249 "max_image_pixels".into(),
6250 "color_conversion_strategy".into(),
6251 "app_title".into(),
6252 "app_logo".into(),
6253 "barcodes_enabled".into(),
6254 "barcode_enable_tiff_support".into(),
6255 "barcode_string".into(),
6256 "barcode_retain_split_pages".into(),
6257 "barcode_enable_asn".into(),
6258 "barcode_asn_prefix".into(),
6259 "barcode_upscale".into(),
6260 "barcode_dpi".into(),
6261 "barcode_max_pages".into(),
6262 "barcode_enable_tag".into(),
6263 ]
6264 }
6265}
6266
6267#[derive(
6268 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
6269)]
6270#[allow(non_snake_case)]
6271pub struct PatchedCorrespondentRequest {
6272 #[serde(default, skip_serializing_if = "Option::is_none")]
6273 pub name: Option<String>,
6274 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
6275 pub match_: Option<String>,
6276 #[serde(default, skip_serializing_if = "Option::is_none")]
6277 pub matching_algorithm: Option<i64>,
6278 #[serde(default, skip_serializing_if = "Option::is_none")]
6279 pub is_insensitive: Option<bool>,
6280 #[serde(default, skip_serializing_if = "Option::is_none")]
6281 pub owner: Option<i64>,
6282 #[serde(default, skip_serializing_if = "Option::is_none")]
6283 pub set_permissions: Option<SetPermissions>,
6284}
6285
6286impl std::fmt::Display for PatchedCorrespondentRequest {
6287 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6288 write!(
6289 f,
6290 "{}",
6291 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6292 )
6293 }
6294}
6295
6296#[cfg(feature = "tabled")]
6297impl tabled::Tabled for PatchedCorrespondentRequest {
6298 const LENGTH: usize = 6;
6299 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6300 vec![
6301 if let Some(name) = &self.name {
6302 format!("{name:?}").into()
6303 } else {
6304 String::new().into()
6305 },
6306 if let Some(match_) = &self.match_ {
6307 format!("{match_:?}").into()
6308 } else {
6309 String::new().into()
6310 },
6311 if let Some(matching_algorithm) = &self.matching_algorithm {
6312 format!("{matching_algorithm:?}").into()
6313 } else {
6314 String::new().into()
6315 },
6316 if let Some(is_insensitive) = &self.is_insensitive {
6317 format!("{is_insensitive:?}").into()
6318 } else {
6319 String::new().into()
6320 },
6321 if let Some(owner) = &self.owner {
6322 format!("{owner:?}").into()
6323 } else {
6324 String::new().into()
6325 },
6326 if let Some(set_permissions) = &self.set_permissions {
6327 format!("{set_permissions:?}").into()
6328 } else {
6329 String::new().into()
6330 },
6331 ]
6332 }
6333
6334 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
6335 vec![
6336 "name".into(),
6337 "match_".into(),
6338 "matching_algorithm".into(),
6339 "is_insensitive".into(),
6340 "owner".into(),
6341 "set_permissions".into(),
6342 ]
6343 }
6344}
6345
6346#[derive(
6347 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
6348)]
6349#[allow(non_snake_case)]
6350pub struct PatchedCustomFieldRequest {
6351 #[serde(default, skip_serializing_if = "Option::is_none")]
6352 pub name: Option<String>,
6353 #[doc = "* `string` - string\n* `url` - url\n* `date` - date\n* `boolean` - boolean\n* `integer` - integer\n* `float` - float\n* `monetary` - monetary\n* `documentlink` - documentlink\n* `select` - select"]
6354 #[serde(default, skip_serializing_if = "Option::is_none")]
6355 pub data_type: Option<DataTypeEnum>,
6356 #[doc = "Extra data for the custom field, such as select options"]
6357 #[serde(default, skip_serializing_if = "Option::is_none")]
6358 pub extra_data: Option<serde_json::Value>,
6359}
6360
6361impl std::fmt::Display for PatchedCustomFieldRequest {
6362 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6363 write!(
6364 f,
6365 "{}",
6366 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6367 )
6368 }
6369}
6370
6371#[cfg(feature = "tabled")]
6372impl tabled::Tabled for PatchedCustomFieldRequest {
6373 const LENGTH: usize = 3;
6374 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6375 vec![
6376 if let Some(name) = &self.name {
6377 format!("{name:?}").into()
6378 } else {
6379 String::new().into()
6380 },
6381 if let Some(data_type) = &self.data_type {
6382 format!("{data_type:?}").into()
6383 } else {
6384 String::new().into()
6385 },
6386 if let Some(extra_data) = &self.extra_data {
6387 format!("{extra_data:?}").into()
6388 } else {
6389 String::new().into()
6390 },
6391 ]
6392 }
6393
6394 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
6395 vec!["name".into(), "data_type".into(), "extra_data".into()]
6396 }
6397}
6398
6399#[doc = "Adds update nested feature"]
6400#[derive(
6401 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
6402)]
6403#[allow(non_snake_case)]
6404pub struct PatchedDocumentRequest {
6405 #[serde(default, skip_serializing_if = "Option::is_none")]
6406 pub correspondent: Option<i64>,
6407 #[serde(default, skip_serializing_if = "Option::is_none")]
6408 pub document_type: Option<i64>,
6409 #[serde(default, skip_serializing_if = "Option::is_none")]
6410 pub storage_path: Option<i64>,
6411 #[serde(default, skip_serializing_if = "Option::is_none")]
6412 pub title: Option<String>,
6413 #[doc = "The raw, text-only data of the document. This field is primarily used for searching."]
6414 #[serde(default, skip_serializing_if = "Option::is_none")]
6415 pub content: Option<String>,
6416 #[serde(default, skip_serializing_if = "Option::is_none")]
6417 pub tags: Option<Vec<i64>>,
6418 #[serde(default, skip_serializing_if = "Option::is_none")]
6419 pub created: Option<chrono::NaiveDate>,
6420 #[serde(default, skip_serializing_if = "Option::is_none")]
6421 #[deprecated]
6422 pub created_date: Option<chrono::NaiveDate>,
6423 #[serde(default, skip_serializing_if = "Option::is_none")]
6424 pub deleted_at: Option<chrono::DateTime<chrono::Utc>>,
6425 #[doc = "The position of this document in your physical document archive."]
6426 #[serde(default, skip_serializing_if = "Option::is_none")]
6427 pub archive_serial_number: Option<i64>,
6428 #[serde(default, skip_serializing_if = "Option::is_none")]
6429 pub owner: Option<i64>,
6430 #[serde(default, skip_serializing_if = "Option::is_none")]
6431 pub set_permissions: Option<SetPermissions>,
6432 #[serde(default, skip_serializing_if = "Option::is_none")]
6433 pub custom_fields: Option<Vec<CustomFieldInstanceRequest>>,
6434 #[serde(default, skip_serializing_if = "Option::is_none")]
6435 pub remove_inbox_tags: Option<bool>,
6436}
6437
6438impl std::fmt::Display for PatchedDocumentRequest {
6439 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6440 write!(
6441 f,
6442 "{}",
6443 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6444 )
6445 }
6446}
6447
6448#[cfg(feature = "tabled")]
6449impl tabled::Tabled for PatchedDocumentRequest {
6450 const LENGTH: usize = 14;
6451 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6452 vec![
6453 if let Some(correspondent) = &self.correspondent {
6454 format!("{correspondent:?}").into()
6455 } else {
6456 String::new().into()
6457 },
6458 if let Some(document_type) = &self.document_type {
6459 format!("{document_type:?}").into()
6460 } else {
6461 String::new().into()
6462 },
6463 if let Some(storage_path) = &self.storage_path {
6464 format!("{storage_path:?}").into()
6465 } else {
6466 String::new().into()
6467 },
6468 if let Some(title) = &self.title {
6469 format!("{title:?}").into()
6470 } else {
6471 String::new().into()
6472 },
6473 if let Some(content) = &self.content {
6474 format!("{content:?}").into()
6475 } else {
6476 String::new().into()
6477 },
6478 if let Some(tags) = &self.tags {
6479 format!("{tags:?}").into()
6480 } else {
6481 String::new().into()
6482 },
6483 if let Some(created) = &self.created {
6484 format!("{created:?}").into()
6485 } else {
6486 String::new().into()
6487 },
6488 if let Some(created_date) = &self.created_date {
6489 format!("{created_date:?}").into()
6490 } else {
6491 String::new().into()
6492 },
6493 if let Some(deleted_at) = &self.deleted_at {
6494 format!("{deleted_at:?}").into()
6495 } else {
6496 String::new().into()
6497 },
6498 if let Some(archive_serial_number) = &self.archive_serial_number {
6499 format!("{archive_serial_number:?}").into()
6500 } else {
6501 String::new().into()
6502 },
6503 if let Some(owner) = &self.owner {
6504 format!("{owner:?}").into()
6505 } else {
6506 String::new().into()
6507 },
6508 if let Some(set_permissions) = &self.set_permissions {
6509 format!("{set_permissions:?}").into()
6510 } else {
6511 String::new().into()
6512 },
6513 if let Some(custom_fields) = &self.custom_fields {
6514 format!("{custom_fields:?}").into()
6515 } else {
6516 String::new().into()
6517 },
6518 if let Some(remove_inbox_tags) = &self.remove_inbox_tags {
6519 format!("{remove_inbox_tags:?}").into()
6520 } else {
6521 String::new().into()
6522 },
6523 ]
6524 }
6525
6526 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
6527 vec![
6528 "correspondent".into(),
6529 "document_type".into(),
6530 "storage_path".into(),
6531 "title".into(),
6532 "content".into(),
6533 "tags".into(),
6534 "created".into(),
6535 "created_date".into(),
6536 "deleted_at".into(),
6537 "archive_serial_number".into(),
6538 "owner".into(),
6539 "set_permissions".into(),
6540 "custom_fields".into(),
6541 "remove_inbox_tags".into(),
6542 ]
6543 }
6544}
6545
6546#[derive(
6547 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
6548)]
6549#[allow(non_snake_case)]
6550pub struct PatchedDocumentTypeRequest {
6551 #[serde(default, skip_serializing_if = "Option::is_none")]
6552 pub name: Option<String>,
6553 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
6554 pub match_: Option<String>,
6555 #[serde(default, skip_serializing_if = "Option::is_none")]
6556 pub matching_algorithm: Option<i64>,
6557 #[serde(default, skip_serializing_if = "Option::is_none")]
6558 pub is_insensitive: Option<bool>,
6559 #[serde(default, skip_serializing_if = "Option::is_none")]
6560 pub owner: Option<i64>,
6561 #[serde(default, skip_serializing_if = "Option::is_none")]
6562 pub set_permissions: Option<SetPermissions>,
6563}
6564
6565impl std::fmt::Display for PatchedDocumentTypeRequest {
6566 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6567 write!(
6568 f,
6569 "{}",
6570 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6571 )
6572 }
6573}
6574
6575#[cfg(feature = "tabled")]
6576impl tabled::Tabled for PatchedDocumentTypeRequest {
6577 const LENGTH: usize = 6;
6578 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6579 vec![
6580 if let Some(name) = &self.name {
6581 format!("{name:?}").into()
6582 } else {
6583 String::new().into()
6584 },
6585 if let Some(match_) = &self.match_ {
6586 format!("{match_:?}").into()
6587 } else {
6588 String::new().into()
6589 },
6590 if let Some(matching_algorithm) = &self.matching_algorithm {
6591 format!("{matching_algorithm:?}").into()
6592 } else {
6593 String::new().into()
6594 },
6595 if let Some(is_insensitive) = &self.is_insensitive {
6596 format!("{is_insensitive:?}").into()
6597 } else {
6598 String::new().into()
6599 },
6600 if let Some(owner) = &self.owner {
6601 format!("{owner:?}").into()
6602 } else {
6603 String::new().into()
6604 },
6605 if let Some(set_permissions) = &self.set_permissions {
6606 format!("{set_permissions:?}").into()
6607 } else {
6608 String::new().into()
6609 },
6610 ]
6611 }
6612
6613 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
6614 vec![
6615 "name".into(),
6616 "match_".into(),
6617 "matching_algorithm".into(),
6618 "is_insensitive".into(),
6619 "owner".into(),
6620 "set_permissions".into(),
6621 ]
6622 }
6623}
6624
6625#[derive(
6626 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
6627)]
6628#[allow(non_snake_case)]
6629pub struct PatchedGroupRequest {
6630 #[serde(default, skip_serializing_if = "Option::is_none")]
6631 pub name: Option<String>,
6632 #[serde(default, skip_serializing_if = "Option::is_none")]
6633 pub permissions: Option<Vec<String>>,
6634}
6635
6636impl std::fmt::Display for PatchedGroupRequest {
6637 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6638 write!(
6639 f,
6640 "{}",
6641 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6642 )
6643 }
6644}
6645
6646#[cfg(feature = "tabled")]
6647impl tabled::Tabled for PatchedGroupRequest {
6648 const LENGTH: usize = 2;
6649 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6650 vec![
6651 if let Some(name) = &self.name {
6652 format!("{name:?}").into()
6653 } else {
6654 String::new().into()
6655 },
6656 if let Some(permissions) = &self.permissions {
6657 format!("{permissions:?}").into()
6658 } else {
6659 String::new().into()
6660 },
6661 ]
6662 }
6663
6664 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
6665 vec!["name".into(), "permissions".into()]
6666 }
6667}
6668
6669#[derive(
6670 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
6671)]
6672#[allow(non_snake_case)]
6673pub struct PatchedMailAccountRequest {
6674 #[serde(default, skip_serializing_if = "Option::is_none")]
6675 pub name: Option<String>,
6676 #[serde(default, skip_serializing_if = "Option::is_none")]
6677 pub imap_server: Option<String>,
6678 #[doc = "This is usually 143 for unencrypted and STARTTLS connections, and 993 for SSL connections."]
6679 #[serde(default, skip_serializing_if = "Option::is_none")]
6680 pub imap_port: Option<i64>,
6681 #[serde(default, skip_serializing_if = "Option::is_none")]
6682 pub imap_security: Option<i64>,
6683 #[serde(default, skip_serializing_if = "Option::is_none")]
6684 pub username: Option<String>,
6685 #[serde(default, skip_serializing_if = "Option::is_none")]
6686 pub password: Option<String>,
6687 #[doc = "The character set to use when communicating with the mail server, such as 'UTF-8' or 'US-ASCII'."]
6688 #[serde(default, skip_serializing_if = "Option::is_none")]
6689 pub character_set: Option<String>,
6690 #[serde(default, skip_serializing_if = "Option::is_none")]
6691 pub is_token: Option<bool>,
6692 #[serde(default, skip_serializing_if = "Option::is_none")]
6693 pub owner: Option<i64>,
6694 #[serde(default, skip_serializing_if = "Option::is_none")]
6695 pub set_permissions: Option<SetPermissions>,
6696 #[serde(default, skip_serializing_if = "Option::is_none")]
6697 pub account_type: Option<i64>,
6698 #[doc = "The expiration date of the refresh token. "]
6699 #[serde(default, skip_serializing_if = "Option::is_none")]
6700 pub expiration: Option<chrono::DateTime<chrono::Utc>>,
6701}
6702
6703impl std::fmt::Display for PatchedMailAccountRequest {
6704 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6705 write!(
6706 f,
6707 "{}",
6708 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6709 )
6710 }
6711}
6712
6713#[cfg(feature = "tabled")]
6714impl tabled::Tabled for PatchedMailAccountRequest {
6715 const LENGTH: usize = 12;
6716 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6717 vec![
6718 if let Some(name) = &self.name {
6719 format!("{name:?}").into()
6720 } else {
6721 String::new().into()
6722 },
6723 if let Some(imap_server) = &self.imap_server {
6724 format!("{imap_server:?}").into()
6725 } else {
6726 String::new().into()
6727 },
6728 if let Some(imap_port) = &self.imap_port {
6729 format!("{imap_port:?}").into()
6730 } else {
6731 String::new().into()
6732 },
6733 if let Some(imap_security) = &self.imap_security {
6734 format!("{imap_security:?}").into()
6735 } else {
6736 String::new().into()
6737 },
6738 if let Some(username) = &self.username {
6739 format!("{username:?}").into()
6740 } else {
6741 String::new().into()
6742 },
6743 if let Some(password) = &self.password {
6744 format!("{password:?}").into()
6745 } else {
6746 String::new().into()
6747 },
6748 if let Some(character_set) = &self.character_set {
6749 format!("{character_set:?}").into()
6750 } else {
6751 String::new().into()
6752 },
6753 if let Some(is_token) = &self.is_token {
6754 format!("{is_token:?}").into()
6755 } else {
6756 String::new().into()
6757 },
6758 if let Some(owner) = &self.owner {
6759 format!("{owner:?}").into()
6760 } else {
6761 String::new().into()
6762 },
6763 if let Some(set_permissions) = &self.set_permissions {
6764 format!("{set_permissions:?}").into()
6765 } else {
6766 String::new().into()
6767 },
6768 if let Some(account_type) = &self.account_type {
6769 format!("{account_type:?}").into()
6770 } else {
6771 String::new().into()
6772 },
6773 if let Some(expiration) = &self.expiration {
6774 format!("{expiration:?}").into()
6775 } else {
6776 String::new().into()
6777 },
6778 ]
6779 }
6780
6781 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
6782 vec![
6783 "name".into(),
6784 "imap_server".into(),
6785 "imap_port".into(),
6786 "imap_security".into(),
6787 "username".into(),
6788 "password".into(),
6789 "character_set".into(),
6790 "is_token".into(),
6791 "owner".into(),
6792 "set_permissions".into(),
6793 "account_type".into(),
6794 "expiration".into(),
6795 ]
6796 }
6797}
6798
6799#[derive(
6800 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
6801)]
6802#[allow(non_snake_case)]
6803pub struct PatchedMailRuleRequest {
6804 #[serde(default, skip_serializing_if = "Option::is_none")]
6805 pub name: Option<String>,
6806 #[serde(default, skip_serializing_if = "Option::is_none")]
6807 pub account: Option<i64>,
6808 #[serde(default, skip_serializing_if = "Option::is_none")]
6809 pub enabled: Option<bool>,
6810 #[doc = "Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server."]
6811 #[serde(default, skip_serializing_if = "Option::is_none")]
6812 pub folder: Option<String>,
6813 #[serde(default, skip_serializing_if = "Option::is_none")]
6814 pub filter_from: Option<String>,
6815 #[serde(default, skip_serializing_if = "Option::is_none")]
6816 pub filter_to: Option<String>,
6817 #[serde(default, skip_serializing_if = "Option::is_none")]
6818 pub filter_subject: Option<String>,
6819 #[serde(default, skip_serializing_if = "Option::is_none")]
6820 pub filter_body: Option<String>,
6821 #[doc = "Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
6822 #[serde(default, skip_serializing_if = "Option::is_none")]
6823 pub filter_attachment_filename_include: Option<String>,
6824 #[doc = "Do not consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
6825 #[serde(default, skip_serializing_if = "Option::is_none")]
6826 pub filter_attachment_filename_exclude: Option<String>,
6827 #[doc = "Specified in days."]
6828 #[serde(default, skip_serializing_if = "Option::is_none")]
6829 pub maximum_age: Option<i64>,
6830 #[serde(default, skip_serializing_if = "Option::is_none")]
6831 pub action: Option<i64>,
6832 #[serde(default, skip_serializing_if = "Option::is_none")]
6833 pub action_parameter: Option<String>,
6834 #[serde(default, skip_serializing_if = "Option::is_none")]
6835 pub assign_title_from: Option<i64>,
6836 #[serde(default, skip_serializing_if = "Option::is_none")]
6837 pub assign_tags: Option<Vec<Option<i64>>>,
6838 #[serde(default, skip_serializing_if = "Option::is_none")]
6839 pub assign_correspondent_from: Option<i64>,
6840 #[serde(default, skip_serializing_if = "Option::is_none")]
6841 pub assign_correspondent: Option<i64>,
6842 #[serde(default, skip_serializing_if = "Option::is_none")]
6843 pub assign_document_type: Option<i64>,
6844 #[serde(default, skip_serializing_if = "Option::is_none")]
6845 pub assign_owner_from_rule: Option<bool>,
6846 #[serde(default, skip_serializing_if = "Option::is_none")]
6847 pub order: Option<i64>,
6848 #[doc = "Inline attachments include embedded images, so it's best to combine this option with a filename filter.\n\n* `1` - Only process attachments.\n* `2` - Process all files, including 'inline' attachments."]
6849 #[serde(default, skip_serializing_if = "Option::is_none")]
6850 pub attachment_type: Option<i64>,
6851 #[serde(default, skip_serializing_if = "Option::is_none")]
6852 pub consumption_scope: Option<i64>,
6853 #[serde(default, skip_serializing_if = "Option::is_none")]
6854 pub pdf_layout: Option<i64>,
6855 #[serde(default, skip_serializing_if = "Option::is_none")]
6856 pub owner: Option<i64>,
6857 #[serde(default, skip_serializing_if = "Option::is_none")]
6858 pub set_permissions: Option<SetPermissions>,
6859}
6860
6861impl std::fmt::Display for PatchedMailRuleRequest {
6862 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
6863 write!(
6864 f,
6865 "{}",
6866 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
6867 )
6868 }
6869}
6870
6871#[cfg(feature = "tabled")]
6872impl tabled::Tabled for PatchedMailRuleRequest {
6873 const LENGTH: usize = 25;
6874 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
6875 vec![
6876 if let Some(name) = &self.name {
6877 format!("{name:?}").into()
6878 } else {
6879 String::new().into()
6880 },
6881 if let Some(account) = &self.account {
6882 format!("{account:?}").into()
6883 } else {
6884 String::new().into()
6885 },
6886 if let Some(enabled) = &self.enabled {
6887 format!("{enabled:?}").into()
6888 } else {
6889 String::new().into()
6890 },
6891 if let Some(folder) = &self.folder {
6892 format!("{folder:?}").into()
6893 } else {
6894 String::new().into()
6895 },
6896 if let Some(filter_from) = &self.filter_from {
6897 format!("{filter_from:?}").into()
6898 } else {
6899 String::new().into()
6900 },
6901 if let Some(filter_to) = &self.filter_to {
6902 format!("{filter_to:?}").into()
6903 } else {
6904 String::new().into()
6905 },
6906 if let Some(filter_subject) = &self.filter_subject {
6907 format!("{filter_subject:?}").into()
6908 } else {
6909 String::new().into()
6910 },
6911 if let Some(filter_body) = &self.filter_body {
6912 format!("{filter_body:?}").into()
6913 } else {
6914 String::new().into()
6915 },
6916 if let Some(filter_attachment_filename_include) =
6917 &self.filter_attachment_filename_include
6918 {
6919 format!("{filter_attachment_filename_include:?}").into()
6920 } else {
6921 String::new().into()
6922 },
6923 if let Some(filter_attachment_filename_exclude) =
6924 &self.filter_attachment_filename_exclude
6925 {
6926 format!("{filter_attachment_filename_exclude:?}").into()
6927 } else {
6928 String::new().into()
6929 },
6930 if let Some(maximum_age) = &self.maximum_age {
6931 format!("{maximum_age:?}").into()
6932 } else {
6933 String::new().into()
6934 },
6935 if let Some(action) = &self.action {
6936 format!("{action:?}").into()
6937 } else {
6938 String::new().into()
6939 },
6940 if let Some(action_parameter) = &self.action_parameter {
6941 format!("{action_parameter:?}").into()
6942 } else {
6943 String::new().into()
6944 },
6945 if let Some(assign_title_from) = &self.assign_title_from {
6946 format!("{assign_title_from:?}").into()
6947 } else {
6948 String::new().into()
6949 },
6950 if let Some(assign_tags) = &self.assign_tags {
6951 format!("{assign_tags:?}").into()
6952 } else {
6953 String::new().into()
6954 },
6955 if let Some(assign_correspondent_from) = &self.assign_correspondent_from {
6956 format!("{assign_correspondent_from:?}").into()
6957 } else {
6958 String::new().into()
6959 },
6960 if let Some(assign_correspondent) = &self.assign_correspondent {
6961 format!("{assign_correspondent:?}").into()
6962 } else {
6963 String::new().into()
6964 },
6965 if let Some(assign_document_type) = &self.assign_document_type {
6966 format!("{assign_document_type:?}").into()
6967 } else {
6968 String::new().into()
6969 },
6970 if let Some(assign_owner_from_rule) = &self.assign_owner_from_rule {
6971 format!("{assign_owner_from_rule:?}").into()
6972 } else {
6973 String::new().into()
6974 },
6975 if let Some(order) = &self.order {
6976 format!("{order:?}").into()
6977 } else {
6978 String::new().into()
6979 },
6980 if let Some(attachment_type) = &self.attachment_type {
6981 format!("{attachment_type:?}").into()
6982 } else {
6983 String::new().into()
6984 },
6985 if let Some(consumption_scope) = &self.consumption_scope {
6986 format!("{consumption_scope:?}").into()
6987 } else {
6988 String::new().into()
6989 },
6990 if let Some(pdf_layout) = &self.pdf_layout {
6991 format!("{pdf_layout:?}").into()
6992 } else {
6993 String::new().into()
6994 },
6995 if let Some(owner) = &self.owner {
6996 format!("{owner:?}").into()
6997 } else {
6998 String::new().into()
6999 },
7000 if let Some(set_permissions) = &self.set_permissions {
7001 format!("{set_permissions:?}").into()
7002 } else {
7003 String::new().into()
7004 },
7005 ]
7006 }
7007
7008 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7009 vec![
7010 "name".into(),
7011 "account".into(),
7012 "enabled".into(),
7013 "folder".into(),
7014 "filter_from".into(),
7015 "filter_to".into(),
7016 "filter_subject".into(),
7017 "filter_body".into(),
7018 "filter_attachment_filename_include".into(),
7019 "filter_attachment_filename_exclude".into(),
7020 "maximum_age".into(),
7021 "action".into(),
7022 "action_parameter".into(),
7023 "assign_title_from".into(),
7024 "assign_tags".into(),
7025 "assign_correspondent_from".into(),
7026 "assign_correspondent".into(),
7027 "assign_document_type".into(),
7028 "assign_owner_from_rule".into(),
7029 "order".into(),
7030 "attachment_type".into(),
7031 "consumption_scope".into(),
7032 "pdf_layout".into(),
7033 "owner".into(),
7034 "set_permissions".into(),
7035 ]
7036 }
7037}
7038
7039#[derive(
7040 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7041)]
7042#[allow(non_snake_case)]
7043pub struct PatchedProfileRequest {
7044 #[serde(default, skip_serializing_if = "Option::is_none")]
7045 pub email: Option<String>,
7046 #[serde(default, skip_serializing_if = "Option::is_none")]
7047 pub password: Option<String>,
7048 #[serde(default, skip_serializing_if = "Option::is_none")]
7049 pub first_name: Option<String>,
7050 #[serde(default, skip_serializing_if = "Option::is_none")]
7051 pub last_name: Option<String>,
7052}
7053
7054impl std::fmt::Display for PatchedProfileRequest {
7055 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
7056 write!(
7057 f,
7058 "{}",
7059 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
7060 )
7061 }
7062}
7063
7064#[cfg(feature = "tabled")]
7065impl tabled::Tabled for PatchedProfileRequest {
7066 const LENGTH: usize = 4;
7067 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
7068 vec![
7069 if let Some(email) = &self.email {
7070 format!("{email:?}").into()
7071 } else {
7072 String::new().into()
7073 },
7074 if let Some(password) = &self.password {
7075 format!("{password:?}").into()
7076 } else {
7077 String::new().into()
7078 },
7079 if let Some(first_name) = &self.first_name {
7080 format!("{first_name:?}").into()
7081 } else {
7082 String::new().into()
7083 },
7084 if let Some(last_name) = &self.last_name {
7085 format!("{last_name:?}").into()
7086 } else {
7087 String::new().into()
7088 },
7089 ]
7090 }
7091
7092 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7093 vec![
7094 "email".into(),
7095 "password".into(),
7096 "first_name".into(),
7097 "last_name".into(),
7098 ]
7099 }
7100}
7101
7102#[derive(
7103 serde :: Serialize,
7104 serde :: Deserialize,
7105 PartialEq,
7106 Hash,
7107 Debug,
7108 Clone,
7109 schemars :: JsonSchema,
7110 parse_display :: FromStr,
7111 parse_display :: Display,
7112)]
7113#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
7114#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
7115pub enum DisplayMode {
7116 #[serde(rename = "table")]
7117 #[display("table")]
7118 Table,
7119 #[serde(rename = "smallCards")]
7120 #[display("smallCards")]
7121 SmallCards,
7122 #[serde(rename = "largeCards")]
7123 #[display("largeCards")]
7124 LargeCards,
7125 #[serde(rename = "")]
7126 #[display("")]
7127 Empty,
7128}
7129
7130#[derive(
7131 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7132)]
7133#[allow(non_snake_case)]
7134pub struct PatchedSavedViewRequest {
7135 #[serde(default, skip_serializing_if = "Option::is_none")]
7136 pub name: Option<String>,
7137 #[serde(default, skip_serializing_if = "Option::is_none")]
7138 pub show_on_dashboard: Option<bool>,
7139 #[serde(default, skip_serializing_if = "Option::is_none")]
7140 pub show_in_sidebar: Option<bool>,
7141 #[serde(default, skip_serializing_if = "Option::is_none")]
7142 pub sort_field: Option<String>,
7143 #[serde(default, skip_serializing_if = "Option::is_none")]
7144 pub sort_reverse: Option<bool>,
7145 #[serde(default, skip_serializing_if = "Option::is_none")]
7146 pub filter_rules: Option<Vec<SavedViewFilterRuleRequest>>,
7147 #[serde(default, skip_serializing_if = "Option::is_none")]
7148 pub page_size: Option<i64>,
7149 #[serde(default, skip_serializing_if = "Option::is_none")]
7150 pub display_mode: Option<DisplayMode>,
7151 #[serde(default, skip_serializing_if = "Option::is_none")]
7152 pub display_fields: Option<serde_json::Value>,
7153 #[serde(default, skip_serializing_if = "Option::is_none")]
7154 pub owner: Option<i64>,
7155}
7156
7157impl std::fmt::Display for PatchedSavedViewRequest {
7158 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
7159 write!(
7160 f,
7161 "{}",
7162 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
7163 )
7164 }
7165}
7166
7167#[cfg(feature = "tabled")]
7168impl tabled::Tabled for PatchedSavedViewRequest {
7169 const LENGTH: usize = 10;
7170 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
7171 vec![
7172 if let Some(name) = &self.name {
7173 format!("{name:?}").into()
7174 } else {
7175 String::new().into()
7176 },
7177 if let Some(show_on_dashboard) = &self.show_on_dashboard {
7178 format!("{show_on_dashboard:?}").into()
7179 } else {
7180 String::new().into()
7181 },
7182 if let Some(show_in_sidebar) = &self.show_in_sidebar {
7183 format!("{show_in_sidebar:?}").into()
7184 } else {
7185 String::new().into()
7186 },
7187 if let Some(sort_field) = &self.sort_field {
7188 format!("{sort_field:?}").into()
7189 } else {
7190 String::new().into()
7191 },
7192 if let Some(sort_reverse) = &self.sort_reverse {
7193 format!("{sort_reverse:?}").into()
7194 } else {
7195 String::new().into()
7196 },
7197 if let Some(filter_rules) = &self.filter_rules {
7198 format!("{filter_rules:?}").into()
7199 } else {
7200 String::new().into()
7201 },
7202 if let Some(page_size) = &self.page_size {
7203 format!("{page_size:?}").into()
7204 } else {
7205 String::new().into()
7206 },
7207 if let Some(display_mode) = &self.display_mode {
7208 format!("{display_mode:?}").into()
7209 } else {
7210 String::new().into()
7211 },
7212 if let Some(display_fields) = &self.display_fields {
7213 format!("{display_fields:?}").into()
7214 } else {
7215 String::new().into()
7216 },
7217 if let Some(owner) = &self.owner {
7218 format!("{owner:?}").into()
7219 } else {
7220 String::new().into()
7221 },
7222 ]
7223 }
7224
7225 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7226 vec![
7227 "name".into(),
7228 "show_on_dashboard".into(),
7229 "show_in_sidebar".into(),
7230 "sort_field".into(),
7231 "sort_reverse".into(),
7232 "filter_rules".into(),
7233 "page_size".into(),
7234 "display_mode".into(),
7235 "display_fields".into(),
7236 "owner".into(),
7237 ]
7238 }
7239}
7240
7241#[derive(
7242 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7243)]
7244#[allow(non_snake_case)]
7245pub struct PatchedShareLinkRequest {
7246 #[serde(default, skip_serializing_if = "Option::is_none")]
7247 pub expiration: Option<chrono::DateTime<chrono::Utc>>,
7248 #[serde(default, skip_serializing_if = "Option::is_none")]
7249 pub document: Option<i64>,
7250 #[doc = "* `archive` - Archive\n* `original` - Original"]
7251 #[serde(default, skip_serializing_if = "Option::is_none")]
7252 pub file_version: Option<FileVersionEnum>,
7253}
7254
7255impl std::fmt::Display for PatchedShareLinkRequest {
7256 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
7257 write!(
7258 f,
7259 "{}",
7260 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
7261 )
7262 }
7263}
7264
7265#[cfg(feature = "tabled")]
7266impl tabled::Tabled for PatchedShareLinkRequest {
7267 const LENGTH: usize = 3;
7268 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
7269 vec![
7270 if let Some(expiration) = &self.expiration {
7271 format!("{expiration:?}").into()
7272 } else {
7273 String::new().into()
7274 },
7275 if let Some(document) = &self.document {
7276 format!("{document:?}").into()
7277 } else {
7278 String::new().into()
7279 },
7280 if let Some(file_version) = &self.file_version {
7281 format!("{file_version:?}").into()
7282 } else {
7283 String::new().into()
7284 },
7285 ]
7286 }
7287
7288 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7289 vec![
7290 "expiration".into(),
7291 "document".into(),
7292 "file_version".into(),
7293 ]
7294 }
7295}
7296
7297#[derive(
7298 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7299)]
7300#[allow(non_snake_case)]
7301pub struct PatchedStoragePathRequest {
7302 #[serde(default, skip_serializing_if = "Option::is_none")]
7303 pub name: Option<String>,
7304 #[serde(default, skip_serializing_if = "Option::is_none")]
7305 pub path: Option<String>,
7306 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
7307 pub match_: Option<String>,
7308 #[serde(default, skip_serializing_if = "Option::is_none")]
7309 pub matching_algorithm: Option<i64>,
7310 #[serde(default, skip_serializing_if = "Option::is_none")]
7311 pub is_insensitive: Option<bool>,
7312 #[serde(default, skip_serializing_if = "Option::is_none")]
7313 pub owner: Option<i64>,
7314 #[serde(default, skip_serializing_if = "Option::is_none")]
7315 pub set_permissions: Option<SetPermissions>,
7316}
7317
7318impl std::fmt::Display for PatchedStoragePathRequest {
7319 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
7320 write!(
7321 f,
7322 "{}",
7323 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
7324 )
7325 }
7326}
7327
7328#[cfg(feature = "tabled")]
7329impl tabled::Tabled for PatchedStoragePathRequest {
7330 const LENGTH: usize = 7;
7331 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
7332 vec![
7333 if let Some(name) = &self.name {
7334 format!("{name:?}").into()
7335 } else {
7336 String::new().into()
7337 },
7338 if let Some(path) = &self.path {
7339 format!("{path:?}").into()
7340 } else {
7341 String::new().into()
7342 },
7343 if let Some(match_) = &self.match_ {
7344 format!("{match_:?}").into()
7345 } else {
7346 String::new().into()
7347 },
7348 if let Some(matching_algorithm) = &self.matching_algorithm {
7349 format!("{matching_algorithm:?}").into()
7350 } else {
7351 String::new().into()
7352 },
7353 if let Some(is_insensitive) = &self.is_insensitive {
7354 format!("{is_insensitive:?}").into()
7355 } else {
7356 String::new().into()
7357 },
7358 if let Some(owner) = &self.owner {
7359 format!("{owner:?}").into()
7360 } else {
7361 String::new().into()
7362 },
7363 if let Some(set_permissions) = &self.set_permissions {
7364 format!("{set_permissions:?}").into()
7365 } else {
7366 String::new().into()
7367 },
7368 ]
7369 }
7370
7371 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7372 vec![
7373 "name".into(),
7374 "path".into(),
7375 "match_".into(),
7376 "matching_algorithm".into(),
7377 "is_insensitive".into(),
7378 "owner".into(),
7379 "set_permissions".into(),
7380 ]
7381 }
7382}
7383
7384#[derive(
7385 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7386)]
7387#[allow(non_snake_case)]
7388pub struct PatchedTagRequest {
7389 #[serde(default, skip_serializing_if = "Option::is_none")]
7390 pub name: Option<String>,
7391 #[serde(default, skip_serializing_if = "Option::is_none")]
7392 pub color: Option<String>,
7393 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
7394 pub match_: Option<String>,
7395 #[serde(default, skip_serializing_if = "Option::is_none")]
7396 pub matching_algorithm: Option<i64>,
7397 #[serde(default, skip_serializing_if = "Option::is_none")]
7398 pub is_insensitive: Option<bool>,
7399 #[doc = "Marks this tag as an inbox tag: All newly consumed documents will be tagged with inbox tags."]
7400 #[serde(default, skip_serializing_if = "Option::is_none")]
7401 pub is_inbox_tag: Option<bool>,
7402 #[serde(default, skip_serializing_if = "Option::is_none")]
7403 pub owner: Option<i64>,
7404 #[serde(default, skip_serializing_if = "Option::is_none")]
7405 pub set_permissions: Option<SetPermissions>,
7406}
7407
7408impl std::fmt::Display for PatchedTagRequest {
7409 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
7410 write!(
7411 f,
7412 "{}",
7413 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
7414 )
7415 }
7416}
7417
7418#[cfg(feature = "tabled")]
7419impl tabled::Tabled for PatchedTagRequest {
7420 const LENGTH: usize = 8;
7421 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
7422 vec![
7423 if let Some(name) = &self.name {
7424 format!("{name:?}").into()
7425 } else {
7426 String::new().into()
7427 },
7428 if let Some(color) = &self.color {
7429 format!("{color:?}").into()
7430 } else {
7431 String::new().into()
7432 },
7433 if let Some(match_) = &self.match_ {
7434 format!("{match_:?}").into()
7435 } else {
7436 String::new().into()
7437 },
7438 if let Some(matching_algorithm) = &self.matching_algorithm {
7439 format!("{matching_algorithm:?}").into()
7440 } else {
7441 String::new().into()
7442 },
7443 if let Some(is_insensitive) = &self.is_insensitive {
7444 format!("{is_insensitive:?}").into()
7445 } else {
7446 String::new().into()
7447 },
7448 if let Some(is_inbox_tag) = &self.is_inbox_tag {
7449 format!("{is_inbox_tag:?}").into()
7450 } else {
7451 String::new().into()
7452 },
7453 if let Some(owner) = &self.owner {
7454 format!("{owner:?}").into()
7455 } else {
7456 String::new().into()
7457 },
7458 if let Some(set_permissions) = &self.set_permissions {
7459 format!("{set_permissions:?}").into()
7460 } else {
7461 String::new().into()
7462 },
7463 ]
7464 }
7465
7466 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7467 vec![
7468 "name".into(),
7469 "color".into(),
7470 "match_".into(),
7471 "matching_algorithm".into(),
7472 "is_insensitive".into(),
7473 "is_inbox_tag".into(),
7474 "owner".into(),
7475 "set_permissions".into(),
7476 ]
7477 }
7478}
7479
7480#[derive(
7481 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7482)]
7483#[allow(non_snake_case)]
7484pub struct PatchedUserRequest {
7485 #[doc = "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."]
7486 #[serde(default, skip_serializing_if = "Option::is_none")]
7487 pub username: Option<String>,
7488 #[serde(default, skip_serializing_if = "Option::is_none")]
7489 pub email: Option<String>,
7490 #[serde(default, skip_serializing_if = "Option::is_none")]
7491 pub password: Option<String>,
7492 #[serde(default, skip_serializing_if = "Option::is_none")]
7493 pub first_name: Option<String>,
7494 #[serde(default, skip_serializing_if = "Option::is_none")]
7495 pub last_name: Option<String>,
7496 #[serde(default, skip_serializing_if = "Option::is_none")]
7497 pub date_joined: Option<chrono::DateTime<chrono::Utc>>,
7498 #[doc = "Designates whether the user can log into this admin site."]
7499 #[serde(default, skip_serializing_if = "Option::is_none")]
7500 pub is_staff: Option<bool>,
7501 #[doc = "Designates whether this user should be treated as active. Unselect this instead of deleting accounts."]
7502 #[serde(default, skip_serializing_if = "Option::is_none")]
7503 pub is_active: Option<bool>,
7504 #[doc = "Designates that this user has all permissions without explicitly assigning them."]
7505 #[serde(default, skip_serializing_if = "Option::is_none")]
7506 pub is_superuser: Option<bool>,
7507 #[doc = "The groups this user belongs to. A user will get all permissions granted to each of their groups."]
7508 #[serde(default, skip_serializing_if = "Option::is_none")]
7509 pub groups: Option<Vec<i64>>,
7510 #[serde(default, skip_serializing_if = "Option::is_none")]
7511 pub user_permissions: Option<Vec<String>>,
7512}
7513
7514impl std::fmt::Display for PatchedUserRequest {
7515 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
7516 write!(
7517 f,
7518 "{}",
7519 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
7520 )
7521 }
7522}
7523
7524#[cfg(feature = "tabled")]
7525impl tabled::Tabled for PatchedUserRequest {
7526 const LENGTH: usize = 11;
7527 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
7528 vec![
7529 if let Some(username) = &self.username {
7530 format!("{username:?}").into()
7531 } else {
7532 String::new().into()
7533 },
7534 if let Some(email) = &self.email {
7535 format!("{email:?}").into()
7536 } else {
7537 String::new().into()
7538 },
7539 if let Some(password) = &self.password {
7540 format!("{password:?}").into()
7541 } else {
7542 String::new().into()
7543 },
7544 if let Some(first_name) = &self.first_name {
7545 format!("{first_name:?}").into()
7546 } else {
7547 String::new().into()
7548 },
7549 if let Some(last_name) = &self.last_name {
7550 format!("{last_name:?}").into()
7551 } else {
7552 String::new().into()
7553 },
7554 if let Some(date_joined) = &self.date_joined {
7555 format!("{date_joined:?}").into()
7556 } else {
7557 String::new().into()
7558 },
7559 if let Some(is_staff) = &self.is_staff {
7560 format!("{is_staff:?}").into()
7561 } else {
7562 String::new().into()
7563 },
7564 if let Some(is_active) = &self.is_active {
7565 format!("{is_active:?}").into()
7566 } else {
7567 String::new().into()
7568 },
7569 if let Some(is_superuser) = &self.is_superuser {
7570 format!("{is_superuser:?}").into()
7571 } else {
7572 String::new().into()
7573 },
7574 if let Some(groups) = &self.groups {
7575 format!("{groups:?}").into()
7576 } else {
7577 String::new().into()
7578 },
7579 if let Some(user_permissions) = &self.user_permissions {
7580 format!("{user_permissions:?}").into()
7581 } else {
7582 String::new().into()
7583 },
7584 ]
7585 }
7586
7587 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7588 vec![
7589 "username".into(),
7590 "email".into(),
7591 "password".into(),
7592 "first_name".into(),
7593 "last_name".into(),
7594 "date_joined".into(),
7595 "is_staff".into(),
7596 "is_active".into(),
7597 "is_superuser".into(),
7598 "groups".into(),
7599 "user_permissions".into(),
7600 ]
7601 }
7602}
7603
7604#[derive(
7605 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7606)]
7607#[allow(non_snake_case)]
7608pub struct PatchedWorkflowActionRequest {
7609 #[serde(default, skip_serializing_if = "Option::is_none")]
7610 pub id: Option<i64>,
7611 #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
7612 pub type_: Option<i64>,
7613 #[doc = "Assign a document title, can include some placeholders, see documentation."]
7614 #[serde(default, skip_serializing_if = "Option::is_none")]
7615 pub assign_title: Option<String>,
7616 #[serde(default, skip_serializing_if = "Option::is_none")]
7617 pub assign_tags: Option<Vec<Option<i64>>>,
7618 #[serde(default, skip_serializing_if = "Option::is_none")]
7619 pub assign_correspondent: Option<i64>,
7620 #[serde(default, skip_serializing_if = "Option::is_none")]
7621 pub assign_document_type: Option<i64>,
7622 #[serde(default, skip_serializing_if = "Option::is_none")]
7623 pub assign_storage_path: Option<i64>,
7624 #[serde(default, skip_serializing_if = "Option::is_none")]
7625 pub assign_owner: Option<i64>,
7626 #[serde(default, skip_serializing_if = "Option::is_none")]
7627 pub assign_view_users: Option<Vec<i64>>,
7628 #[serde(default, skip_serializing_if = "Option::is_none")]
7629 pub assign_view_groups: Option<Vec<i64>>,
7630 #[serde(default, skip_serializing_if = "Option::is_none")]
7631 pub assign_change_users: Option<Vec<i64>>,
7632 #[serde(default, skip_serializing_if = "Option::is_none")]
7633 pub assign_change_groups: Option<Vec<i64>>,
7634 #[serde(default, skip_serializing_if = "Option::is_none")]
7635 pub assign_custom_fields: Option<Vec<i64>>,
7636 #[doc = "Optional values to assign to the custom fields."]
7637 #[serde(default, skip_serializing_if = "Option::is_none")]
7638 pub assign_custom_fields_values: Option<serde_json::Value>,
7639 #[serde(default, skip_serializing_if = "Option::is_none")]
7640 pub remove_all_tags: Option<bool>,
7641 #[serde(default, skip_serializing_if = "Option::is_none")]
7642 pub remove_tags: Option<Vec<i64>>,
7643 #[serde(default, skip_serializing_if = "Option::is_none")]
7644 pub remove_all_correspondents: Option<bool>,
7645 #[serde(default, skip_serializing_if = "Option::is_none")]
7646 pub remove_correspondents: Option<Vec<i64>>,
7647 #[serde(default, skip_serializing_if = "Option::is_none")]
7648 pub remove_all_document_types: Option<bool>,
7649 #[serde(default, skip_serializing_if = "Option::is_none")]
7650 pub remove_document_types: Option<Vec<i64>>,
7651 #[serde(default, skip_serializing_if = "Option::is_none")]
7652 pub remove_all_storage_paths: Option<bool>,
7653 #[serde(default, skip_serializing_if = "Option::is_none")]
7654 pub remove_storage_paths: Option<Vec<i64>>,
7655 #[serde(default, skip_serializing_if = "Option::is_none")]
7656 pub remove_custom_fields: Option<Vec<i64>>,
7657 #[serde(default, skip_serializing_if = "Option::is_none")]
7658 pub remove_all_custom_fields: Option<bool>,
7659 #[serde(default, skip_serializing_if = "Option::is_none")]
7660 pub remove_all_owners: Option<bool>,
7661 #[serde(default, skip_serializing_if = "Option::is_none")]
7662 pub remove_owners: Option<Vec<i64>>,
7663 #[serde(default, skip_serializing_if = "Option::is_none")]
7664 pub remove_all_permissions: Option<bool>,
7665 #[serde(default, skip_serializing_if = "Option::is_none")]
7666 pub remove_view_users: Option<Vec<i64>>,
7667 #[serde(default, skip_serializing_if = "Option::is_none")]
7668 pub remove_view_groups: Option<Vec<i64>>,
7669 #[serde(default, skip_serializing_if = "Option::is_none")]
7670 pub remove_change_users: Option<Vec<i64>>,
7671 #[serde(default, skip_serializing_if = "Option::is_none")]
7672 pub remove_change_groups: Option<Vec<i64>>,
7673 #[serde(default, skip_serializing_if = "Option::is_none")]
7674 pub email: Option<WorkflowActionEmailRequest>,
7675 #[serde(default, skip_serializing_if = "Option::is_none")]
7676 pub webhook: Option<WorkflowActionWebhookRequest>,
7677}
7678
7679impl std::fmt::Display for PatchedWorkflowActionRequest {
7680 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
7681 write!(
7682 f,
7683 "{}",
7684 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
7685 )
7686 }
7687}
7688
7689#[cfg(feature = "tabled")]
7690impl tabled::Tabled for PatchedWorkflowActionRequest {
7691 const LENGTH: usize = 33;
7692 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
7693 vec![
7694 if let Some(id) = &self.id {
7695 format!("{id:?}").into()
7696 } else {
7697 String::new().into()
7698 },
7699 if let Some(type_) = &self.type_ {
7700 format!("{type_:?}").into()
7701 } else {
7702 String::new().into()
7703 },
7704 if let Some(assign_title) = &self.assign_title {
7705 format!("{assign_title:?}").into()
7706 } else {
7707 String::new().into()
7708 },
7709 if let Some(assign_tags) = &self.assign_tags {
7710 format!("{assign_tags:?}").into()
7711 } else {
7712 String::new().into()
7713 },
7714 if let Some(assign_correspondent) = &self.assign_correspondent {
7715 format!("{assign_correspondent:?}").into()
7716 } else {
7717 String::new().into()
7718 },
7719 if let Some(assign_document_type) = &self.assign_document_type {
7720 format!("{assign_document_type:?}").into()
7721 } else {
7722 String::new().into()
7723 },
7724 if let Some(assign_storage_path) = &self.assign_storage_path {
7725 format!("{assign_storage_path:?}").into()
7726 } else {
7727 String::new().into()
7728 },
7729 if let Some(assign_owner) = &self.assign_owner {
7730 format!("{assign_owner:?}").into()
7731 } else {
7732 String::new().into()
7733 },
7734 if let Some(assign_view_users) = &self.assign_view_users {
7735 format!("{assign_view_users:?}").into()
7736 } else {
7737 String::new().into()
7738 },
7739 if let Some(assign_view_groups) = &self.assign_view_groups {
7740 format!("{assign_view_groups:?}").into()
7741 } else {
7742 String::new().into()
7743 },
7744 if let Some(assign_change_users) = &self.assign_change_users {
7745 format!("{assign_change_users:?}").into()
7746 } else {
7747 String::new().into()
7748 },
7749 if let Some(assign_change_groups) = &self.assign_change_groups {
7750 format!("{assign_change_groups:?}").into()
7751 } else {
7752 String::new().into()
7753 },
7754 if let Some(assign_custom_fields) = &self.assign_custom_fields {
7755 format!("{assign_custom_fields:?}").into()
7756 } else {
7757 String::new().into()
7758 },
7759 if let Some(assign_custom_fields_values) = &self.assign_custom_fields_values {
7760 format!("{assign_custom_fields_values:?}").into()
7761 } else {
7762 String::new().into()
7763 },
7764 if let Some(remove_all_tags) = &self.remove_all_tags {
7765 format!("{remove_all_tags:?}").into()
7766 } else {
7767 String::new().into()
7768 },
7769 if let Some(remove_tags) = &self.remove_tags {
7770 format!("{remove_tags:?}").into()
7771 } else {
7772 String::new().into()
7773 },
7774 if let Some(remove_all_correspondents) = &self.remove_all_correspondents {
7775 format!("{remove_all_correspondents:?}").into()
7776 } else {
7777 String::new().into()
7778 },
7779 if let Some(remove_correspondents) = &self.remove_correspondents {
7780 format!("{remove_correspondents:?}").into()
7781 } else {
7782 String::new().into()
7783 },
7784 if let Some(remove_all_document_types) = &self.remove_all_document_types {
7785 format!("{remove_all_document_types:?}").into()
7786 } else {
7787 String::new().into()
7788 },
7789 if let Some(remove_document_types) = &self.remove_document_types {
7790 format!("{remove_document_types:?}").into()
7791 } else {
7792 String::new().into()
7793 },
7794 if let Some(remove_all_storage_paths) = &self.remove_all_storage_paths {
7795 format!("{remove_all_storage_paths:?}").into()
7796 } else {
7797 String::new().into()
7798 },
7799 if let Some(remove_storage_paths) = &self.remove_storage_paths {
7800 format!("{remove_storage_paths:?}").into()
7801 } else {
7802 String::new().into()
7803 },
7804 if let Some(remove_custom_fields) = &self.remove_custom_fields {
7805 format!("{remove_custom_fields:?}").into()
7806 } else {
7807 String::new().into()
7808 },
7809 if let Some(remove_all_custom_fields) = &self.remove_all_custom_fields {
7810 format!("{remove_all_custom_fields:?}").into()
7811 } else {
7812 String::new().into()
7813 },
7814 if let Some(remove_all_owners) = &self.remove_all_owners {
7815 format!("{remove_all_owners:?}").into()
7816 } else {
7817 String::new().into()
7818 },
7819 if let Some(remove_owners) = &self.remove_owners {
7820 format!("{remove_owners:?}").into()
7821 } else {
7822 String::new().into()
7823 },
7824 if let Some(remove_all_permissions) = &self.remove_all_permissions {
7825 format!("{remove_all_permissions:?}").into()
7826 } else {
7827 String::new().into()
7828 },
7829 if let Some(remove_view_users) = &self.remove_view_users {
7830 format!("{remove_view_users:?}").into()
7831 } else {
7832 String::new().into()
7833 },
7834 if let Some(remove_view_groups) = &self.remove_view_groups {
7835 format!("{remove_view_groups:?}").into()
7836 } else {
7837 String::new().into()
7838 },
7839 if let Some(remove_change_users) = &self.remove_change_users {
7840 format!("{remove_change_users:?}").into()
7841 } else {
7842 String::new().into()
7843 },
7844 if let Some(remove_change_groups) = &self.remove_change_groups {
7845 format!("{remove_change_groups:?}").into()
7846 } else {
7847 String::new().into()
7848 },
7849 if let Some(email) = &self.email {
7850 format!("{email:?}").into()
7851 } else {
7852 String::new().into()
7853 },
7854 if let Some(webhook) = &self.webhook {
7855 format!("{webhook:?}").into()
7856 } else {
7857 String::new().into()
7858 },
7859 ]
7860 }
7861
7862 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7863 vec![
7864 "id".into(),
7865 "type_".into(),
7866 "assign_title".into(),
7867 "assign_tags".into(),
7868 "assign_correspondent".into(),
7869 "assign_document_type".into(),
7870 "assign_storage_path".into(),
7871 "assign_owner".into(),
7872 "assign_view_users".into(),
7873 "assign_view_groups".into(),
7874 "assign_change_users".into(),
7875 "assign_change_groups".into(),
7876 "assign_custom_fields".into(),
7877 "assign_custom_fields_values".into(),
7878 "remove_all_tags".into(),
7879 "remove_tags".into(),
7880 "remove_all_correspondents".into(),
7881 "remove_correspondents".into(),
7882 "remove_all_document_types".into(),
7883 "remove_document_types".into(),
7884 "remove_all_storage_paths".into(),
7885 "remove_storage_paths".into(),
7886 "remove_custom_fields".into(),
7887 "remove_all_custom_fields".into(),
7888 "remove_all_owners".into(),
7889 "remove_owners".into(),
7890 "remove_all_permissions".into(),
7891 "remove_view_users".into(),
7892 "remove_view_groups".into(),
7893 "remove_change_users".into(),
7894 "remove_change_groups".into(),
7895 "email".into(),
7896 "webhook".into(),
7897 ]
7898 }
7899}
7900
7901#[derive(
7902 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7903)]
7904#[allow(non_snake_case)]
7905pub struct PatchedWorkflowRequest {
7906 #[serde(default, skip_serializing_if = "Option::is_none")]
7907 pub name: Option<String>,
7908 #[serde(default, skip_serializing_if = "Option::is_none")]
7909 pub order: Option<i64>,
7910 #[serde(default, skip_serializing_if = "Option::is_none")]
7911 pub enabled: Option<bool>,
7912 #[serde(default, skip_serializing_if = "Option::is_none")]
7913 pub triggers: Option<Vec<WorkflowTriggerRequest>>,
7914 #[serde(default, skip_serializing_if = "Option::is_none")]
7915 pub actions: Option<Vec<WorkflowActionRequest>>,
7916}
7917
7918impl std::fmt::Display for PatchedWorkflowRequest {
7919 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
7920 write!(
7921 f,
7922 "{}",
7923 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
7924 )
7925 }
7926}
7927
7928#[cfg(feature = "tabled")]
7929impl tabled::Tabled for PatchedWorkflowRequest {
7930 const LENGTH: usize = 5;
7931 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
7932 vec![
7933 if let Some(name) = &self.name {
7934 format!("{name:?}").into()
7935 } else {
7936 String::new().into()
7937 },
7938 if let Some(order) = &self.order {
7939 format!("{order:?}").into()
7940 } else {
7941 String::new().into()
7942 },
7943 if let Some(enabled) = &self.enabled {
7944 format!("{enabled:?}").into()
7945 } else {
7946 String::new().into()
7947 },
7948 if let Some(triggers) = &self.triggers {
7949 format!("{triggers:?}").into()
7950 } else {
7951 String::new().into()
7952 },
7953 if let Some(actions) = &self.actions {
7954 format!("{actions:?}").into()
7955 } else {
7956 String::new().into()
7957 },
7958 ]
7959 }
7960
7961 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
7962 vec![
7963 "name".into(),
7964 "order".into(),
7965 "enabled".into(),
7966 "triggers".into(),
7967 "actions".into(),
7968 ]
7969 }
7970}
7971
7972#[derive(
7973 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
7974)]
7975#[allow(non_snake_case)]
7976pub struct PatchedWorkflowTriggerRequest {
7977 #[serde(default, skip_serializing_if = "Option::is_none")]
7978 pub id: Option<i64>,
7979 #[serde(default)]
7980 pub sources: Vec<i64>,
7981 #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
7982 pub type_: Option<i64>,
7983 #[doc = "Only consume documents with a path that matches this if specified. Wildcards specified as * are allowed. Case insensitive."]
7984 #[serde(default, skip_serializing_if = "Option::is_none")]
7985 pub filter_path: Option<String>,
7986 #[doc = "Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
7987 #[serde(default, skip_serializing_if = "Option::is_none")]
7988 pub filter_filename: Option<String>,
7989 #[serde(default, skip_serializing_if = "Option::is_none")]
7990 pub filter_mailrule: Option<i64>,
7991 #[serde(default, skip_serializing_if = "Option::is_none")]
7992 pub matching_algorithm: Option<i64>,
7993 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
7994 pub match_: Option<String>,
7995 #[serde(default, skip_serializing_if = "Option::is_none")]
7996 pub is_insensitive: Option<bool>,
7997 #[serde(default, skip_serializing_if = "Option::is_none")]
7998 pub filter_has_tags: Option<Vec<i64>>,
7999 #[serde(default, skip_serializing_if = "Option::is_none")]
8000 pub filter_has_correspondent: Option<i64>,
8001 #[serde(default, skip_serializing_if = "Option::is_none")]
8002 pub filter_has_document_type: Option<i64>,
8003 #[doc = "The number of days to offset the schedule trigger by."]
8004 #[serde(default, skip_serializing_if = "Option::is_none")]
8005 pub schedule_offset_days: Option<i64>,
8006 #[doc = "If the schedule should be recurring."]
8007 #[serde(default, skip_serializing_if = "Option::is_none")]
8008 pub schedule_is_recurring: Option<bool>,
8009 #[doc = "The number of days between recurring schedule triggers."]
8010 #[serde(default, skip_serializing_if = "Option::is_none")]
8011 pub schedule_recurring_interval_days: Option<i64>,
8012 #[doc = "The field to check for a schedule trigger.\n\n* `added` - Added\n* `created` - Created\n* `modified` - Modified\n* `custom_field` - Custom Field"]
8013 #[serde(default, skip_serializing_if = "Option::is_none")]
8014 pub schedule_date_field: Option<ScheduleDateFieldEnum>,
8015 #[serde(default, skip_serializing_if = "Option::is_none")]
8016 pub schedule_date_custom_field: Option<i64>,
8017}
8018
8019impl std::fmt::Display for PatchedWorkflowTriggerRequest {
8020 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8021 write!(
8022 f,
8023 "{}",
8024 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8025 )
8026 }
8027}
8028
8029#[cfg(feature = "tabled")]
8030impl tabled::Tabled for PatchedWorkflowTriggerRequest {
8031 const LENGTH: usize = 17;
8032 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8033 vec![
8034 if let Some(id) = &self.id {
8035 format!("{id:?}").into()
8036 } else {
8037 String::new().into()
8038 },
8039 format!("{:?}", self.sources).into(),
8040 if let Some(type_) = &self.type_ {
8041 format!("{type_:?}").into()
8042 } else {
8043 String::new().into()
8044 },
8045 if let Some(filter_path) = &self.filter_path {
8046 format!("{filter_path:?}").into()
8047 } else {
8048 String::new().into()
8049 },
8050 if let Some(filter_filename) = &self.filter_filename {
8051 format!("{filter_filename:?}").into()
8052 } else {
8053 String::new().into()
8054 },
8055 if let Some(filter_mailrule) = &self.filter_mailrule {
8056 format!("{filter_mailrule:?}").into()
8057 } else {
8058 String::new().into()
8059 },
8060 if let Some(matching_algorithm) = &self.matching_algorithm {
8061 format!("{matching_algorithm:?}").into()
8062 } else {
8063 String::new().into()
8064 },
8065 if let Some(match_) = &self.match_ {
8066 format!("{match_:?}").into()
8067 } else {
8068 String::new().into()
8069 },
8070 if let Some(is_insensitive) = &self.is_insensitive {
8071 format!("{is_insensitive:?}").into()
8072 } else {
8073 String::new().into()
8074 },
8075 if let Some(filter_has_tags) = &self.filter_has_tags {
8076 format!("{filter_has_tags:?}").into()
8077 } else {
8078 String::new().into()
8079 },
8080 if let Some(filter_has_correspondent) = &self.filter_has_correspondent {
8081 format!("{filter_has_correspondent:?}").into()
8082 } else {
8083 String::new().into()
8084 },
8085 if let Some(filter_has_document_type) = &self.filter_has_document_type {
8086 format!("{filter_has_document_type:?}").into()
8087 } else {
8088 String::new().into()
8089 },
8090 if let Some(schedule_offset_days) = &self.schedule_offset_days {
8091 format!("{schedule_offset_days:?}").into()
8092 } else {
8093 String::new().into()
8094 },
8095 if let Some(schedule_is_recurring) = &self.schedule_is_recurring {
8096 format!("{schedule_is_recurring:?}").into()
8097 } else {
8098 String::new().into()
8099 },
8100 if let Some(schedule_recurring_interval_days) = &self.schedule_recurring_interval_days {
8101 format!("{schedule_recurring_interval_days:?}").into()
8102 } else {
8103 String::new().into()
8104 },
8105 if let Some(schedule_date_field) = &self.schedule_date_field {
8106 format!("{schedule_date_field:?}").into()
8107 } else {
8108 String::new().into()
8109 },
8110 if let Some(schedule_date_custom_field) = &self.schedule_date_custom_field {
8111 format!("{schedule_date_custom_field:?}").into()
8112 } else {
8113 String::new().into()
8114 },
8115 ]
8116 }
8117
8118 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8119 vec![
8120 "id".into(),
8121 "sources".into(),
8122 "type_".into(),
8123 "filter_path".into(),
8124 "filter_filename".into(),
8125 "filter_mailrule".into(),
8126 "matching_algorithm".into(),
8127 "match_".into(),
8128 "is_insensitive".into(),
8129 "filter_has_tags".into(),
8130 "filter_has_correspondent".into(),
8131 "filter_has_document_type".into(),
8132 "schedule_offset_days".into(),
8133 "schedule_is_recurring".into(),
8134 "schedule_recurring_interval_days".into(),
8135 "schedule_date_field".into(),
8136 "schedule_date_custom_field".into(),
8137 ]
8138 }
8139}
8140
8141#[derive(
8142 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8143)]
8144#[allow(non_snake_case)]
8145pub struct PostDocumentRequest {
8146 #[serde(default, skip_serializing_if = "Option::is_none")]
8147 pub created: Option<chrono::DateTime<chrono::Utc>>,
8148 pub document: bytes::Bytes,
8149 #[serde(default, skip_serializing_if = "Option::is_none")]
8150 pub title: Option<String>,
8151 #[serde(default, skip_serializing_if = "Option::is_none")]
8152 pub correspondent: Option<i64>,
8153 #[serde(default, skip_serializing_if = "Option::is_none")]
8154 pub document_type: Option<i64>,
8155 #[serde(default, skip_serializing_if = "Option::is_none")]
8156 pub storage_path: Option<i64>,
8157 #[serde(default, skip_serializing_if = "Option::is_none")]
8158 pub tags: Option<Vec<i64>>,
8159 #[serde(default, skip_serializing_if = "Option::is_none")]
8160 pub archive_serial_number: Option<i64>,
8161 #[serde(default, skip_serializing_if = "Option::is_none")]
8162 pub custom_fields: Option<Vec<i64>>,
8163 #[serde(default, skip_serializing_if = "Option::is_none")]
8164 pub from_webui: Option<bool>,
8165}
8166
8167impl std::fmt::Display for PostDocumentRequest {
8168 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8169 write!(
8170 f,
8171 "{}",
8172 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8173 )
8174 }
8175}
8176
8177#[cfg(feature = "tabled")]
8178impl tabled::Tabled for PostDocumentRequest {
8179 const LENGTH: usize = 10;
8180 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8181 vec![
8182 if let Some(created) = &self.created {
8183 format!("{created:?}").into()
8184 } else {
8185 String::new().into()
8186 },
8187 format!("{:?}", self.document).into(),
8188 if let Some(title) = &self.title {
8189 format!("{title:?}").into()
8190 } else {
8191 String::new().into()
8192 },
8193 if let Some(correspondent) = &self.correspondent {
8194 format!("{correspondent:?}").into()
8195 } else {
8196 String::new().into()
8197 },
8198 if let Some(document_type) = &self.document_type {
8199 format!("{document_type:?}").into()
8200 } else {
8201 String::new().into()
8202 },
8203 if let Some(storage_path) = &self.storage_path {
8204 format!("{storage_path:?}").into()
8205 } else {
8206 String::new().into()
8207 },
8208 if let Some(tags) = &self.tags {
8209 format!("{tags:?}").into()
8210 } else {
8211 String::new().into()
8212 },
8213 if let Some(archive_serial_number) = &self.archive_serial_number {
8214 format!("{archive_serial_number:?}").into()
8215 } else {
8216 String::new().into()
8217 },
8218 if let Some(custom_fields) = &self.custom_fields {
8219 format!("{custom_fields:?}").into()
8220 } else {
8221 String::new().into()
8222 },
8223 if let Some(from_webui) = &self.from_webui {
8224 format!("{from_webui:?}").into()
8225 } else {
8226 String::new().into()
8227 },
8228 ]
8229 }
8230
8231 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8232 vec![
8233 "created".into(),
8234 "document".into(),
8235 "title".into(),
8236 "correspondent".into(),
8237 "document_type".into(),
8238 "storage_path".into(),
8239 "tags".into(),
8240 "archive_serial_number".into(),
8241 "custom_fields".into(),
8242 "from_webui".into(),
8243 ]
8244 }
8245}
8246
8247#[derive(
8248 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8249)]
8250#[allow(non_snake_case)]
8251pub struct Profile {
8252 #[serde(default, skip_serializing_if = "Option::is_none")]
8253 pub email: Option<String>,
8254 #[serde(default, skip_serializing_if = "Option::is_none")]
8255 pub password: Option<String>,
8256 #[serde(default, skip_serializing_if = "Option::is_none")]
8257 pub first_name: Option<String>,
8258 #[serde(default, skip_serializing_if = "Option::is_none")]
8259 pub last_name: Option<String>,
8260 pub auth_token: String,
8261 pub social_accounts: Vec<SocialAccount>,
8262 pub has_usable_password: bool,
8263 pub is_mfa_enabled: bool,
8264}
8265
8266impl std::fmt::Display for Profile {
8267 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8268 write!(
8269 f,
8270 "{}",
8271 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8272 )
8273 }
8274}
8275
8276#[cfg(feature = "tabled")]
8277impl tabled::Tabled for Profile {
8278 const LENGTH: usize = 8;
8279 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8280 vec![
8281 if let Some(email) = &self.email {
8282 format!("{email:?}").into()
8283 } else {
8284 String::new().into()
8285 },
8286 if let Some(password) = &self.password {
8287 format!("{password:?}").into()
8288 } else {
8289 String::new().into()
8290 },
8291 if let Some(first_name) = &self.first_name {
8292 format!("{first_name:?}").into()
8293 } else {
8294 String::new().into()
8295 },
8296 if let Some(last_name) = &self.last_name {
8297 format!("{last_name:?}").into()
8298 } else {
8299 String::new().into()
8300 },
8301 self.auth_token.clone().into(),
8302 format!("{:?}", self.social_accounts).into(),
8303 format!("{:?}", self.has_usable_password).into(),
8304 format!("{:?}", self.is_mfa_enabled).into(),
8305 ]
8306 }
8307
8308 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8309 vec![
8310 "email".into(),
8311 "password".into(),
8312 "first_name".into(),
8313 "last_name".into(),
8314 "auth_token".into(),
8315 "social_accounts".into(),
8316 "has_usable_password".into(),
8317 "is_mfa_enabled".into(),
8318 ]
8319 }
8320}
8321
8322#[derive(
8323 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8324)]
8325#[allow(non_snake_case)]
8326pub struct SanityCheck {
8327 pub status: String,
8328 pub error: String,
8329 pub last_run: chrono::DateTime<chrono::Utc>,
8330}
8331
8332impl std::fmt::Display for SanityCheck {
8333 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8334 write!(
8335 f,
8336 "{}",
8337 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8338 )
8339 }
8340}
8341
8342#[cfg(feature = "tabled")]
8343impl tabled::Tabled for SanityCheck {
8344 const LENGTH: usize = 3;
8345 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8346 vec![
8347 self.status.clone().into(),
8348 self.error.clone().into(),
8349 format!("{:?}", self.last_run).into(),
8350 ]
8351 }
8352
8353 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8354 vec!["status".into(), "error".into(), "last_run".into()]
8355 }
8356}
8357
8358#[derive(
8359 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8360)]
8361#[allow(non_snake_case)]
8362pub struct SavedView {
8363 pub id: i64,
8364 pub name: String,
8365 pub show_on_dashboard: bool,
8366 pub show_in_sidebar: bool,
8367 #[serde(default, skip_serializing_if = "Option::is_none")]
8368 pub sort_field: Option<String>,
8369 #[serde(default, skip_serializing_if = "Option::is_none")]
8370 pub sort_reverse: Option<bool>,
8371 pub filter_rules: Vec<SavedViewFilterRule>,
8372 #[serde(default, skip_serializing_if = "Option::is_none")]
8373 pub page_size: Option<i64>,
8374 #[serde(default, skip_serializing_if = "Option::is_none")]
8375 pub display_mode: Option<DisplayMode>,
8376 #[serde(default, skip_serializing_if = "Option::is_none")]
8377 pub display_fields: Option<serde_json::Value>,
8378 #[serde(default, skip_serializing_if = "Option::is_none")]
8379 pub owner: Option<i64>,
8380 pub user_can_change: bool,
8381}
8382
8383impl std::fmt::Display for SavedView {
8384 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8385 write!(
8386 f,
8387 "{}",
8388 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8389 )
8390 }
8391}
8392
8393#[cfg(feature = "tabled")]
8394impl tabled::Tabled for SavedView {
8395 const LENGTH: usize = 12;
8396 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8397 vec![
8398 format!("{:?}", self.id).into(),
8399 self.name.clone().into(),
8400 format!("{:?}", self.show_on_dashboard).into(),
8401 format!("{:?}", self.show_in_sidebar).into(),
8402 if let Some(sort_field) = &self.sort_field {
8403 format!("{sort_field:?}").into()
8404 } else {
8405 String::new().into()
8406 },
8407 if let Some(sort_reverse) = &self.sort_reverse {
8408 format!("{sort_reverse:?}").into()
8409 } else {
8410 String::new().into()
8411 },
8412 format!("{:?}", self.filter_rules).into(),
8413 if let Some(page_size) = &self.page_size {
8414 format!("{page_size:?}").into()
8415 } else {
8416 String::new().into()
8417 },
8418 if let Some(display_mode) = &self.display_mode {
8419 format!("{display_mode:?}").into()
8420 } else {
8421 String::new().into()
8422 },
8423 if let Some(display_fields) = &self.display_fields {
8424 format!("{display_fields:?}").into()
8425 } else {
8426 String::new().into()
8427 },
8428 if let Some(owner) = &self.owner {
8429 format!("{owner:?}").into()
8430 } else {
8431 String::new().into()
8432 },
8433 format!("{:?}", self.user_can_change).into(),
8434 ]
8435 }
8436
8437 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8438 vec![
8439 "id".into(),
8440 "name".into(),
8441 "show_on_dashboard".into(),
8442 "show_in_sidebar".into(),
8443 "sort_field".into(),
8444 "sort_reverse".into(),
8445 "filter_rules".into(),
8446 "page_size".into(),
8447 "display_mode".into(),
8448 "display_fields".into(),
8449 "owner".into(),
8450 "user_can_change".into(),
8451 ]
8452 }
8453}
8454
8455#[derive(
8456 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8457)]
8458#[allow(non_snake_case)]
8459pub struct SavedViewFilterRule {
8460 pub rule_type: i64,
8461 #[serde(default, skip_serializing_if = "Option::is_none")]
8462 pub value: Option<String>,
8463}
8464
8465impl std::fmt::Display for SavedViewFilterRule {
8466 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8467 write!(
8468 f,
8469 "{}",
8470 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8471 )
8472 }
8473}
8474
8475#[cfg(feature = "tabled")]
8476impl tabled::Tabled for SavedViewFilterRule {
8477 const LENGTH: usize = 2;
8478 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8479 vec![
8480 format!("{:?}", self.rule_type).into(),
8481 if let Some(value) = &self.value {
8482 format!("{value:?}").into()
8483 } else {
8484 String::new().into()
8485 },
8486 ]
8487 }
8488
8489 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8490 vec!["rule_type".into(), "value".into()]
8491 }
8492}
8493
8494#[derive(
8495 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8496)]
8497#[allow(non_snake_case)]
8498pub struct SavedViewFilterRuleRequest {
8499 pub rule_type: i64,
8500 #[serde(default, skip_serializing_if = "Option::is_none")]
8501 pub value: Option<String>,
8502}
8503
8504impl std::fmt::Display for SavedViewFilterRuleRequest {
8505 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8506 write!(
8507 f,
8508 "{}",
8509 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8510 )
8511 }
8512}
8513
8514#[cfg(feature = "tabled")]
8515impl tabled::Tabled for SavedViewFilterRuleRequest {
8516 const LENGTH: usize = 2;
8517 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8518 vec![
8519 format!("{:?}", self.rule_type).into(),
8520 if let Some(value) = &self.value {
8521 format!("{value:?}").into()
8522 } else {
8523 String::new().into()
8524 },
8525 ]
8526 }
8527
8528 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8529 vec!["rule_type".into(), "value".into()]
8530 }
8531}
8532
8533#[derive(
8534 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8535)]
8536#[allow(non_snake_case)]
8537pub struct SavedViewRequest {
8538 pub name: String,
8539 pub show_on_dashboard: bool,
8540 pub show_in_sidebar: bool,
8541 #[serde(default, skip_serializing_if = "Option::is_none")]
8542 pub sort_field: Option<String>,
8543 #[serde(default, skip_serializing_if = "Option::is_none")]
8544 pub sort_reverse: Option<bool>,
8545 pub filter_rules: Vec<SavedViewFilterRuleRequest>,
8546 #[serde(default, skip_serializing_if = "Option::is_none")]
8547 pub page_size: Option<i64>,
8548 #[serde(default, skip_serializing_if = "Option::is_none")]
8549 pub display_mode: Option<DisplayMode>,
8550 #[serde(default, skip_serializing_if = "Option::is_none")]
8551 pub display_fields: Option<serde_json::Value>,
8552 #[serde(default, skip_serializing_if = "Option::is_none")]
8553 pub owner: Option<i64>,
8554}
8555
8556impl std::fmt::Display for SavedViewRequest {
8557 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8558 write!(
8559 f,
8560 "{}",
8561 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8562 )
8563 }
8564}
8565
8566#[cfg(feature = "tabled")]
8567impl tabled::Tabled for SavedViewRequest {
8568 const LENGTH: usize = 10;
8569 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8570 vec![
8571 self.name.clone().into(),
8572 format!("{:?}", self.show_on_dashboard).into(),
8573 format!("{:?}", self.show_in_sidebar).into(),
8574 if let Some(sort_field) = &self.sort_field {
8575 format!("{sort_field:?}").into()
8576 } else {
8577 String::new().into()
8578 },
8579 if let Some(sort_reverse) = &self.sort_reverse {
8580 format!("{sort_reverse:?}").into()
8581 } else {
8582 String::new().into()
8583 },
8584 format!("{:?}", self.filter_rules).into(),
8585 if let Some(page_size) = &self.page_size {
8586 format!("{page_size:?}").into()
8587 } else {
8588 String::new().into()
8589 },
8590 if let Some(display_mode) = &self.display_mode {
8591 format!("{display_mode:?}").into()
8592 } else {
8593 String::new().into()
8594 },
8595 if let Some(display_fields) = &self.display_fields {
8596 format!("{display_fields:?}").into()
8597 } else {
8598 String::new().into()
8599 },
8600 if let Some(owner) = &self.owner {
8601 format!("{owner:?}").into()
8602 } else {
8603 String::new().into()
8604 },
8605 ]
8606 }
8607
8608 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8609 vec![
8610 "name".into(),
8611 "show_on_dashboard".into(),
8612 "show_in_sidebar".into(),
8613 "sort_field".into(),
8614 "sort_reverse".into(),
8615 "filter_rules".into(),
8616 "page_size".into(),
8617 "display_mode".into(),
8618 "display_fields".into(),
8619 "owner".into(),
8620 ]
8621 }
8622}
8623
8624#[doc = "* `added` - Added\n* `created` - Created\n* `modified` - Modified\n* `custom_field` - Custom Field"]
8625#[derive(
8626 serde :: Serialize,
8627 serde :: Deserialize,
8628 PartialEq,
8629 Hash,
8630 Debug,
8631 Clone,
8632 schemars :: JsonSchema,
8633 parse_display :: FromStr,
8634 parse_display :: Display,
8635)]
8636#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
8637#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
8638pub enum ScheduleDateFieldEnum {
8639 #[serde(rename = "added")]
8640 #[display("added")]
8641 Added,
8642 #[serde(rename = "created")]
8643 #[display("created")]
8644 Created,
8645 #[serde(rename = "modified")]
8646 #[display("modified")]
8647 Modified,
8648 #[serde(rename = "custom_field")]
8649 #[display("custom_field")]
8650 CustomField,
8651}
8652
8653#[derive(
8654 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8655)]
8656#[allow(non_snake_case)]
8657pub struct SearchResult {
8658 pub total: i64,
8659 pub documents: Vec<Document>,
8660 pub saved_views: Vec<SavedView>,
8661 pub tags: Vec<Tag>,
8662 pub correspondents: Vec<Correspondent>,
8663 pub document_types: Vec<DocumentType>,
8664 pub storage_paths: Vec<StoragePath>,
8665 pub users: Vec<User>,
8666 pub groups: Vec<Group>,
8667 pub mail_rules: Vec<MailRule>,
8668 pub mail_accounts: Vec<MailAccount>,
8669 pub workflows: Vec<Workflow>,
8670 pub custom_fields: Vec<CustomField>,
8671}
8672
8673impl std::fmt::Display for SearchResult {
8674 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8675 write!(
8676 f,
8677 "{}",
8678 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8679 )
8680 }
8681}
8682
8683#[cfg(feature = "tabled")]
8684impl tabled::Tabled for SearchResult {
8685 const LENGTH: usize = 13;
8686 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8687 vec![
8688 format!("{:?}", self.total).into(),
8689 format!("{:?}", self.documents).into(),
8690 format!("{:?}", self.saved_views).into(),
8691 format!("{:?}", self.tags).into(),
8692 format!("{:?}", self.correspondents).into(),
8693 format!("{:?}", self.document_types).into(),
8694 format!("{:?}", self.storage_paths).into(),
8695 format!("{:?}", self.users).into(),
8696 format!("{:?}", self.groups).into(),
8697 format!("{:?}", self.mail_rules).into(),
8698 format!("{:?}", self.mail_accounts).into(),
8699 format!("{:?}", self.workflows).into(),
8700 format!("{:?}", self.custom_fields).into(),
8701 ]
8702 }
8703
8704 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8705 vec![
8706 "total".into(),
8707 "documents".into(),
8708 "saved_views".into(),
8709 "tags".into(),
8710 "correspondents".into(),
8711 "document_types".into(),
8712 "storage_paths".into(),
8713 "users".into(),
8714 "groups".into(),
8715 "mail_rules".into(),
8716 "mail_accounts".into(),
8717 "workflows".into(),
8718 "custom_fields".into(),
8719 ]
8720 }
8721}
8722
8723#[derive(
8724 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8725)]
8726#[allow(non_snake_case)]
8727pub struct SelectionData {
8728 pub selected_correspondents: Vec<CorrespondentCounts>,
8729 pub selected_tags: Vec<TagCounts>,
8730 pub selected_document_types: Vec<DocumentTypeCounts>,
8731 pub selected_storage_paths: Vec<StoragePathCounts>,
8732 pub selected_custom_fields: Vec<CustomFieldCounts>,
8733}
8734
8735impl std::fmt::Display for SelectionData {
8736 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8737 write!(
8738 f,
8739 "{}",
8740 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8741 )
8742 }
8743}
8744
8745#[cfg(feature = "tabled")]
8746impl tabled::Tabled for SelectionData {
8747 const LENGTH: usize = 5;
8748 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8749 vec![
8750 format!("{:?}", self.selected_correspondents).into(),
8751 format!("{:?}", self.selected_tags).into(),
8752 format!("{:?}", self.selected_document_types).into(),
8753 format!("{:?}", self.selected_storage_paths).into(),
8754 format!("{:?}", self.selected_custom_fields).into(),
8755 ]
8756 }
8757
8758 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8759 vec![
8760 "selected_correspondents".into(),
8761 "selected_tags".into(),
8762 "selected_document_types".into(),
8763 "selected_storage_paths".into(),
8764 "selected_custom_fields".into(),
8765 ]
8766 }
8767}
8768
8769#[derive(
8770 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8771)]
8772#[allow(non_snake_case)]
8773pub struct ShareLink {
8774 pub id: i64,
8775 pub created: chrono::DateTime<chrono::Utc>,
8776 #[serde(default, skip_serializing_if = "Option::is_none")]
8777 pub expiration: Option<chrono::DateTime<chrono::Utc>>,
8778 pub slug: String,
8779 #[serde(default, skip_serializing_if = "Option::is_none")]
8780 pub document: Option<i64>,
8781 #[doc = "* `archive` - Archive\n* `original` - Original"]
8782 #[serde(default, skip_serializing_if = "Option::is_none")]
8783 pub file_version: Option<FileVersionEnum>,
8784}
8785
8786impl std::fmt::Display for ShareLink {
8787 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8788 write!(
8789 f,
8790 "{}",
8791 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8792 )
8793 }
8794}
8795
8796#[cfg(feature = "tabled")]
8797impl tabled::Tabled for ShareLink {
8798 const LENGTH: usize = 6;
8799 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8800 vec![
8801 format!("{:?}", self.id).into(),
8802 format!("{:?}", self.created).into(),
8803 if let Some(expiration) = &self.expiration {
8804 format!("{expiration:?}").into()
8805 } else {
8806 String::new().into()
8807 },
8808 self.slug.clone().into(),
8809 if let Some(document) = &self.document {
8810 format!("{document:?}").into()
8811 } else {
8812 String::new().into()
8813 },
8814 if let Some(file_version) = &self.file_version {
8815 format!("{file_version:?}").into()
8816 } else {
8817 String::new().into()
8818 },
8819 ]
8820 }
8821
8822 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8823 vec![
8824 "id".into(),
8825 "created".into(),
8826 "expiration".into(),
8827 "slug".into(),
8828 "document".into(),
8829 "file_version".into(),
8830 ]
8831 }
8832}
8833
8834#[derive(
8835 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8836)]
8837#[allow(non_snake_case)]
8838pub struct ShareLinkRequest {
8839 #[serde(default, skip_serializing_if = "Option::is_none")]
8840 pub expiration: Option<chrono::DateTime<chrono::Utc>>,
8841 #[serde(default, skip_serializing_if = "Option::is_none")]
8842 pub document: Option<i64>,
8843 #[doc = "* `archive` - Archive\n* `original` - Original"]
8844 #[serde(default, skip_serializing_if = "Option::is_none")]
8845 pub file_version: Option<FileVersionEnum>,
8846}
8847
8848impl std::fmt::Display for ShareLinkRequest {
8849 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8850 write!(
8851 f,
8852 "{}",
8853 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8854 )
8855 }
8856}
8857
8858#[cfg(feature = "tabled")]
8859impl tabled::Tabled for ShareLinkRequest {
8860 const LENGTH: usize = 3;
8861 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8862 vec![
8863 if let Some(expiration) = &self.expiration {
8864 format!("{expiration:?}").into()
8865 } else {
8866 String::new().into()
8867 },
8868 if let Some(document) = &self.document {
8869 format!("{document:?}").into()
8870 } else {
8871 String::new().into()
8872 },
8873 if let Some(file_version) = &self.file_version {
8874 format!("{file_version:?}").into()
8875 } else {
8876 String::new().into()
8877 },
8878 ]
8879 }
8880
8881 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8882 vec![
8883 "expiration".into(),
8884 "document".into(),
8885 "file_version".into(),
8886 ]
8887 }
8888}
8889
8890#[doc = "* `never` - never\n* `with_text` - with_text\n* `always` - always"]
8891#[derive(
8892 serde :: Serialize,
8893 serde :: Deserialize,
8894 PartialEq,
8895 Hash,
8896 Debug,
8897 Clone,
8898 schemars :: JsonSchema,
8899 parse_display :: FromStr,
8900 parse_display :: Display,
8901)]
8902#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
8903#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
8904pub enum SkipArchiveFileEnum {
8905 #[serde(rename = "never")]
8906 #[display("never")]
8907 Never,
8908 #[serde(rename = "with_text")]
8909 #[display("with_text")]
8910 WithText,
8911 #[serde(rename = "always")]
8912 #[display("always")]
8913 Always,
8914 #[serde(rename = "")]
8915 #[display("")]
8916 Empty,
8917}
8918
8919#[derive(
8920 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8921)]
8922#[allow(non_snake_case)]
8923pub struct SocialAccount {
8924 pub id: i64,
8925 pub provider: String,
8926 pub name: String,
8927}
8928
8929impl std::fmt::Display for SocialAccount {
8930 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8931 write!(
8932 f,
8933 "{}",
8934 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8935 )
8936 }
8937}
8938
8939#[cfg(feature = "tabled")]
8940impl tabled::Tabled for SocialAccount {
8941 const LENGTH: usize = 3;
8942 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8943 vec![
8944 format!("{:?}", self.id).into(),
8945 self.provider.clone().into(),
8946 self.name.clone().into(),
8947 ]
8948 }
8949
8950 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8951 vec!["id".into(), "provider".into(), "name".into()]
8952 }
8953}
8954
8955#[derive(
8956 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
8957)]
8958#[allow(non_snake_case)]
8959pub struct SocialAccountRequest {
8960 pub provider: String,
8961}
8962
8963impl std::fmt::Display for SocialAccountRequest {
8964 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
8965 write!(
8966 f,
8967 "{}",
8968 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
8969 )
8970 }
8971}
8972
8973#[cfg(feature = "tabled")]
8974impl tabled::Tabled for SocialAccountRequest {
8975 const LENGTH: usize = 1;
8976 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
8977 vec![self.provider.clone().into()]
8978 }
8979
8980 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
8981 vec!["provider".into()]
8982 }
8983}
8984
8985#[doc = "* `FAILURE` - FAILURE\n* `PENDING` - PENDING\n* `RECEIVED` - RECEIVED\n* `RETRY` - RETRY\n* `REVOKED` - REVOKED\n* `STARTED` - STARTED\n* `SUCCESS` - SUCCESS"]
8986#[derive(
8987 serde :: Serialize,
8988 serde :: Deserialize,
8989 PartialEq,
8990 Hash,
8991 Debug,
8992 Clone,
8993 schemars :: JsonSchema,
8994 parse_display :: FromStr,
8995 parse_display :: Display,
8996)]
8997#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
8998#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
8999pub enum StatusEnum {
9000 #[serde(rename = "FAILURE")]
9001 #[display("FAILURE")]
9002 Failure,
9003 #[serde(rename = "PENDING")]
9004 #[display("PENDING")]
9005 Pending,
9006 #[serde(rename = "RECEIVED")]
9007 #[display("RECEIVED")]
9008 Received,
9009 #[serde(rename = "RETRY")]
9010 #[display("RETRY")]
9011 Retry,
9012 #[serde(rename = "REVOKED")]
9013 #[display("REVOKED")]
9014 Revoked,
9015 #[serde(rename = "STARTED")]
9016 #[display("STARTED")]
9017 Started,
9018 #[serde(rename = "SUCCESS")]
9019 #[display("SUCCESS")]
9020 Success,
9021}
9022
9023#[derive(
9024 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9025)]
9026#[allow(non_snake_case)]
9027pub struct Storage {
9028 pub total: i64,
9029 pub available: i64,
9030}
9031
9032impl std::fmt::Display for Storage {
9033 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9034 write!(
9035 f,
9036 "{}",
9037 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9038 )
9039 }
9040}
9041
9042#[cfg(feature = "tabled")]
9043impl tabled::Tabled for Storage {
9044 const LENGTH: usize = 2;
9045 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9046 vec![
9047 format!("{:?}", self.total).into(),
9048 format!("{:?}", self.available).into(),
9049 ]
9050 }
9051
9052 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9053 vec!["total".into(), "available".into()]
9054 }
9055}
9056
9057#[derive(
9058 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9059)]
9060#[allow(non_snake_case)]
9061pub struct StoragePath {
9062 pub id: i64,
9063 pub slug: String,
9064 pub name: String,
9065 pub path: String,
9066 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
9067 pub match_: Option<String>,
9068 #[serde(default, skip_serializing_if = "Option::is_none")]
9069 pub matching_algorithm: Option<i64>,
9070 #[serde(default, skip_serializing_if = "Option::is_none")]
9071 pub is_insensitive: Option<bool>,
9072 pub document_count: i64,
9073 #[serde(default, skip_serializing_if = "Option::is_none")]
9074 pub owner: Option<i64>,
9075 pub user_can_change: bool,
9076}
9077
9078impl std::fmt::Display for StoragePath {
9079 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9080 write!(
9081 f,
9082 "{}",
9083 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9084 )
9085 }
9086}
9087
9088#[cfg(feature = "tabled")]
9089impl tabled::Tabled for StoragePath {
9090 const LENGTH: usize = 10;
9091 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9092 vec![
9093 format!("{:?}", self.id).into(),
9094 self.slug.clone().into(),
9095 self.name.clone().into(),
9096 self.path.clone().into(),
9097 if let Some(match_) = &self.match_ {
9098 format!("{match_:?}").into()
9099 } else {
9100 String::new().into()
9101 },
9102 if let Some(matching_algorithm) = &self.matching_algorithm {
9103 format!("{matching_algorithm:?}").into()
9104 } else {
9105 String::new().into()
9106 },
9107 if let Some(is_insensitive) = &self.is_insensitive {
9108 format!("{is_insensitive:?}").into()
9109 } else {
9110 String::new().into()
9111 },
9112 format!("{:?}", self.document_count).into(),
9113 if let Some(owner) = &self.owner {
9114 format!("{owner:?}").into()
9115 } else {
9116 String::new().into()
9117 },
9118 format!("{:?}", self.user_can_change).into(),
9119 ]
9120 }
9121
9122 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9123 vec![
9124 "id".into(),
9125 "slug".into(),
9126 "name".into(),
9127 "path".into(),
9128 "match_".into(),
9129 "matching_algorithm".into(),
9130 "is_insensitive".into(),
9131 "document_count".into(),
9132 "owner".into(),
9133 "user_can_change".into(),
9134 ]
9135 }
9136}
9137
9138#[derive(
9139 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9140)]
9141#[allow(non_snake_case)]
9142pub struct StoragePathCounts {
9143 pub id: i64,
9144 pub document_count: i64,
9145}
9146
9147impl std::fmt::Display for StoragePathCounts {
9148 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9149 write!(
9150 f,
9151 "{}",
9152 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9153 )
9154 }
9155}
9156
9157#[cfg(feature = "tabled")]
9158impl tabled::Tabled for StoragePathCounts {
9159 const LENGTH: usize = 2;
9160 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9161 vec![
9162 format!("{:?}", self.id).into(),
9163 format!("{:?}", self.document_count).into(),
9164 ]
9165 }
9166
9167 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9168 vec!["id".into(), "document_count".into()]
9169 }
9170}
9171
9172#[derive(
9173 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9174)]
9175#[allow(non_snake_case)]
9176pub struct StoragePathRequest {
9177 pub name: String,
9178 pub path: String,
9179 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
9180 pub match_: Option<String>,
9181 #[serde(default, skip_serializing_if = "Option::is_none")]
9182 pub matching_algorithm: Option<i64>,
9183 #[serde(default, skip_serializing_if = "Option::is_none")]
9184 pub is_insensitive: Option<bool>,
9185 #[serde(default, skip_serializing_if = "Option::is_none")]
9186 pub owner: Option<i64>,
9187 #[serde(default, skip_serializing_if = "Option::is_none")]
9188 pub set_permissions: Option<SetPermissions>,
9189}
9190
9191impl std::fmt::Display for StoragePathRequest {
9192 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9193 write!(
9194 f,
9195 "{}",
9196 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9197 )
9198 }
9199}
9200
9201#[cfg(feature = "tabled")]
9202impl tabled::Tabled for StoragePathRequest {
9203 const LENGTH: usize = 7;
9204 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9205 vec![
9206 self.name.clone().into(),
9207 self.path.clone().into(),
9208 if let Some(match_) = &self.match_ {
9209 format!("{match_:?}").into()
9210 } else {
9211 String::new().into()
9212 },
9213 if let Some(matching_algorithm) = &self.matching_algorithm {
9214 format!("{matching_algorithm:?}").into()
9215 } else {
9216 String::new().into()
9217 },
9218 if let Some(is_insensitive) = &self.is_insensitive {
9219 format!("{is_insensitive:?}").into()
9220 } else {
9221 String::new().into()
9222 },
9223 if let Some(owner) = &self.owner {
9224 format!("{owner:?}").into()
9225 } else {
9226 String::new().into()
9227 },
9228 if let Some(set_permissions) = &self.set_permissions {
9229 format!("{set_permissions:?}").into()
9230 } else {
9231 String::new().into()
9232 },
9233 ]
9234 }
9235
9236 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9237 vec![
9238 "name".into(),
9239 "path".into(),
9240 "match_".into(),
9241 "matching_algorithm".into(),
9242 "is_insensitive".into(),
9243 "owner".into(),
9244 "set_permissions".into(),
9245 ]
9246 }
9247}
9248
9249#[derive(
9250 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9251)]
9252#[allow(non_snake_case)]
9253pub struct Suggestions {
9254 pub correspondents: Vec<i64>,
9255 pub tags: Vec<i64>,
9256 pub document_types: Vec<i64>,
9257 pub storage_paths: Vec<i64>,
9258 pub dates: Vec<String>,
9259}
9260
9261impl std::fmt::Display for Suggestions {
9262 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9263 write!(
9264 f,
9265 "{}",
9266 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9267 )
9268 }
9269}
9270
9271#[cfg(feature = "tabled")]
9272impl tabled::Tabled for Suggestions {
9273 const LENGTH: usize = 5;
9274 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9275 vec![
9276 format!("{:?}", self.correspondents).into(),
9277 format!("{:?}", self.tags).into(),
9278 format!("{:?}", self.document_types).into(),
9279 format!("{:?}", self.storage_paths).into(),
9280 format!("{:?}", self.dates).into(),
9281 ]
9282 }
9283
9284 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9285 vec![
9286 "correspondents".into(),
9287 "tags".into(),
9288 "document_types".into(),
9289 "storage_paths".into(),
9290 "dates".into(),
9291 ]
9292 }
9293}
9294
9295#[derive(
9296 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9297)]
9298#[allow(non_snake_case)]
9299pub struct SystemStatus {
9300 pub pngx_version: String,
9301 pub server_os: String,
9302 pub install_type: String,
9303 pub storage: Storage,
9304 pub database: Database,
9305 pub tasks: Tasks,
9306 pub index: Index,
9307 pub classifier: Classifier,
9308 pub sanity_check: SanityCheck,
9309}
9310
9311impl std::fmt::Display for SystemStatus {
9312 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9313 write!(
9314 f,
9315 "{}",
9316 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9317 )
9318 }
9319}
9320
9321#[cfg(feature = "tabled")]
9322impl tabled::Tabled for SystemStatus {
9323 const LENGTH: usize = 9;
9324 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9325 vec![
9326 self.pngx_version.clone().into(),
9327 self.server_os.clone().into(),
9328 self.install_type.clone().into(),
9329 format!("{:?}", self.storage).into(),
9330 format!("{:?}", self.database).into(),
9331 format!("{:?}", self.tasks).into(),
9332 format!("{:?}", self.index).into(),
9333 format!("{:?}", self.classifier).into(),
9334 format!("{:?}", self.sanity_check).into(),
9335 ]
9336 }
9337
9338 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9339 vec![
9340 "pngx_version".into(),
9341 "server_os".into(),
9342 "install_type".into(),
9343 "storage".into(),
9344 "database".into(),
9345 "tasks".into(),
9346 "index".into(),
9347 "classifier".into(),
9348 "sanity_check".into(),
9349 ]
9350 }
9351}
9352
9353#[derive(
9354 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9355)]
9356#[allow(non_snake_case)]
9357pub struct Tag {
9358 pub id: i64,
9359 pub slug: String,
9360 pub name: String,
9361 #[serde(default, skip_serializing_if = "Option::is_none")]
9362 pub color: Option<String>,
9363 pub text_color: String,
9364 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
9365 pub match_: Option<String>,
9366 #[serde(default, skip_serializing_if = "Option::is_none")]
9367 pub matching_algorithm: Option<i64>,
9368 #[serde(default, skip_serializing_if = "Option::is_none")]
9369 pub is_insensitive: Option<bool>,
9370 #[doc = "Marks this tag as an inbox tag: All newly consumed documents will be tagged with inbox tags."]
9371 #[serde(default, skip_serializing_if = "Option::is_none")]
9372 pub is_inbox_tag: Option<bool>,
9373 #[serde(default)]
9374 pub document_count: i64,
9375 #[serde(default, skip_serializing_if = "Option::is_none")]
9376 pub owner: Option<i64>,
9377 pub user_can_change: bool,
9378}
9379
9380impl std::fmt::Display for Tag {
9381 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9382 write!(
9383 f,
9384 "{}",
9385 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9386 )
9387 }
9388}
9389
9390#[cfg(feature = "tabled")]
9391impl tabled::Tabled for Tag {
9392 const LENGTH: usize = 12;
9393 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9394 vec![
9395 format!("{:?}", self.id).into(),
9396 self.slug.clone().into(),
9397 self.name.clone().into(),
9398 if let Some(color) = &self.color {
9399 format!("{color:?}").into()
9400 } else {
9401 String::new().into()
9402 },
9403 self.text_color.clone().into(),
9404 if let Some(match_) = &self.match_ {
9405 format!("{match_:?}").into()
9406 } else {
9407 String::new().into()
9408 },
9409 if let Some(matching_algorithm) = &self.matching_algorithm {
9410 format!("{matching_algorithm:?}").into()
9411 } else {
9412 String::new().into()
9413 },
9414 if let Some(is_insensitive) = &self.is_insensitive {
9415 format!("{is_insensitive:?}").into()
9416 } else {
9417 String::new().into()
9418 },
9419 if let Some(is_inbox_tag) = &self.is_inbox_tag {
9420 format!("{is_inbox_tag:?}").into()
9421 } else {
9422 String::new().into()
9423 },
9424 format!("{:?}", self.document_count).into(),
9425 if let Some(owner) = &self.owner {
9426 format!("{owner:?}").into()
9427 } else {
9428 String::new().into()
9429 },
9430 format!("{:?}", self.user_can_change).into(),
9431 ]
9432 }
9433
9434 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9435 vec![
9436 "id".into(),
9437 "slug".into(),
9438 "name".into(),
9439 "color".into(),
9440 "text_color".into(),
9441 "match_".into(),
9442 "matching_algorithm".into(),
9443 "is_insensitive".into(),
9444 "is_inbox_tag".into(),
9445 "document_count".into(),
9446 "owner".into(),
9447 "user_can_change".into(),
9448 ]
9449 }
9450}
9451
9452#[derive(
9453 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9454)]
9455#[allow(non_snake_case)]
9456pub struct TagCounts {
9457 pub id: i64,
9458 pub document_count: i64,
9459}
9460
9461impl std::fmt::Display for TagCounts {
9462 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9463 write!(
9464 f,
9465 "{}",
9466 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9467 )
9468 }
9469}
9470
9471#[cfg(feature = "tabled")]
9472impl tabled::Tabled for TagCounts {
9473 const LENGTH: usize = 2;
9474 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9475 vec![
9476 format!("{:?}", self.id).into(),
9477 format!("{:?}", self.document_count).into(),
9478 ]
9479 }
9480
9481 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9482 vec!["id".into(), "document_count".into()]
9483 }
9484}
9485
9486#[derive(
9487 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9488)]
9489#[allow(non_snake_case)]
9490pub struct TagRequest {
9491 pub name: String,
9492 #[serde(default, skip_serializing_if = "Option::is_none")]
9493 pub color: Option<String>,
9494 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
9495 pub match_: Option<String>,
9496 #[serde(default, skip_serializing_if = "Option::is_none")]
9497 pub matching_algorithm: Option<i64>,
9498 #[serde(default, skip_serializing_if = "Option::is_none")]
9499 pub is_insensitive: Option<bool>,
9500 #[doc = "Marks this tag as an inbox tag: All newly consumed documents will be tagged with inbox tags."]
9501 #[serde(default, skip_serializing_if = "Option::is_none")]
9502 pub is_inbox_tag: Option<bool>,
9503 #[serde(default, skip_serializing_if = "Option::is_none")]
9504 pub owner: Option<i64>,
9505 #[serde(default, skip_serializing_if = "Option::is_none")]
9506 pub set_permissions: Option<SetPermissions>,
9507}
9508
9509impl std::fmt::Display for TagRequest {
9510 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9511 write!(
9512 f,
9513 "{}",
9514 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9515 )
9516 }
9517}
9518
9519#[cfg(feature = "tabled")]
9520impl tabled::Tabled for TagRequest {
9521 const LENGTH: usize = 8;
9522 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9523 vec![
9524 self.name.clone().into(),
9525 if let Some(color) = &self.color {
9526 format!("{color:?}").into()
9527 } else {
9528 String::new().into()
9529 },
9530 if let Some(match_) = &self.match_ {
9531 format!("{match_:?}").into()
9532 } else {
9533 String::new().into()
9534 },
9535 if let Some(matching_algorithm) = &self.matching_algorithm {
9536 format!("{matching_algorithm:?}").into()
9537 } else {
9538 String::new().into()
9539 },
9540 if let Some(is_insensitive) = &self.is_insensitive {
9541 format!("{is_insensitive:?}").into()
9542 } else {
9543 String::new().into()
9544 },
9545 if let Some(is_inbox_tag) = &self.is_inbox_tag {
9546 format!("{is_inbox_tag:?}").into()
9547 } else {
9548 String::new().into()
9549 },
9550 if let Some(owner) = &self.owner {
9551 format!("{owner:?}").into()
9552 } else {
9553 String::new().into()
9554 },
9555 if let Some(set_permissions) = &self.set_permissions {
9556 format!("{set_permissions:?}").into()
9557 } else {
9558 String::new().into()
9559 },
9560 ]
9561 }
9562
9563 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9564 vec![
9565 "name".into(),
9566 "color".into(),
9567 "match_".into(),
9568 "matching_algorithm".into(),
9569 "is_insensitive".into(),
9570 "is_inbox_tag".into(),
9571 "owner".into(),
9572 "set_permissions".into(),
9573 ]
9574 }
9575}
9576
9577#[doc = "* `consume_file` - Consume File\n* `train_classifier` - Train Classifier\n* `check_sanity` - Check Sanity\n* `index_optimize` - Index Optimize"]
9578#[derive(
9579 serde :: Serialize,
9580 serde :: Deserialize,
9581 PartialEq,
9582 Hash,
9583 Debug,
9584 Clone,
9585 schemars :: JsonSchema,
9586 parse_display :: FromStr,
9587 parse_display :: Display,
9588)]
9589#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
9590#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
9591pub enum TaskNameEnum {
9592 #[serde(rename = "consume_file")]
9593 #[display("consume_file")]
9594 ConsumeFile,
9595 #[serde(rename = "train_classifier")]
9596 #[display("train_classifier")]
9597 TrainClassifier,
9598 #[serde(rename = "check_sanity")]
9599 #[display("check_sanity")]
9600 CheckSanity,
9601 #[serde(rename = "index_optimize")]
9602 #[display("index_optimize")]
9603 IndexOptimize,
9604}
9605
9606#[derive(
9607 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9608)]
9609#[allow(non_snake_case)]
9610pub struct Tasks {
9611 pub redis_url: String,
9612 pub redis_status: String,
9613 pub redis_error: String,
9614 pub celery_status: String,
9615}
9616
9617impl std::fmt::Display for Tasks {
9618 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9619 write!(
9620 f,
9621 "{}",
9622 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9623 )
9624 }
9625}
9626
9627#[cfg(feature = "tabled")]
9628impl tabled::Tabled for Tasks {
9629 const LENGTH: usize = 4;
9630 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9631 vec![
9632 self.redis_url.clone().into(),
9633 self.redis_status.clone().into(),
9634 self.redis_error.clone().into(),
9635 self.celery_status.clone().into(),
9636 ]
9637 }
9638
9639 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9640 vec![
9641 "redis_url".into(),
9642 "redis_status".into(),
9643 "redis_error".into(),
9644 "celery_status".into(),
9645 ]
9646 }
9647}
9648
9649#[doc = "Name of the task that was run\n\n* `consume_file` - Consume File\n* `train_classifier` - Train Classifier\n* `check_sanity` - Check Sanity\n* `index_optimize` - Index Optimize"]
9650#[derive(
9651 serde :: Serialize,
9652 serde :: Deserialize,
9653 PartialEq,
9654 Hash,
9655 Debug,
9656 Clone,
9657 schemars :: JsonSchema,
9658 parse_display :: FromStr,
9659 parse_display :: Display,
9660)]
9661#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
9662#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
9663pub enum TaskName {
9664 #[serde(rename = "consume_file")]
9665 #[display("consume_file")]
9666 ConsumeFile,
9667 #[serde(rename = "train_classifier")]
9668 #[display("train_classifier")]
9669 TrainClassifier,
9670 #[serde(rename = "check_sanity")]
9671 #[display("check_sanity")]
9672 CheckSanity,
9673 #[serde(rename = "index_optimize")]
9674 #[display("index_optimize")]
9675 IndexOptimize,
9676}
9677
9678#[derive(
9679 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9680)]
9681#[allow(non_snake_case)]
9682pub struct TasksView {
9683 pub id: i64,
9684 #[doc = "Celery ID for the Task that was run"]
9685 pub task_id: String,
9686 #[doc = "Name of the task that was run\n\n* `consume_file` - Consume File\n* `train_classifier` - Train Classifier\n* `check_sanity` - Check Sanity\n* `index_optimize` - Index Optimize"]
9687 #[serde(default, skip_serializing_if = "Option::is_none")]
9688 pub task_name: Option<TaskName>,
9689 #[doc = "Name of the file which the Task was run for"]
9690 #[serde(default, skip_serializing_if = "Option::is_none")]
9691 pub task_file_name: Option<String>,
9692 #[doc = "Datetime field when the task result was created in UTC"]
9693 #[serde(default, skip_serializing_if = "Option::is_none")]
9694 pub date_created: Option<chrono::DateTime<chrono::Utc>>,
9695 #[doc = "Datetime field when the task was completed in UTC"]
9696 #[serde(default, skip_serializing_if = "Option::is_none")]
9697 pub date_done: Option<chrono::DateTime<chrono::Utc>>,
9698 #[doc = "The type of task that was run\n\n* `auto_task` - Auto Task\n* `scheduled_task` - Scheduled Task\n* `manual_task` - Manual Task"]
9699 #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
9700 pub type_: Option<TasksViewTypeEnum>,
9701 #[doc = "Current state of the task being run\n\n* `FAILURE` - FAILURE\n* `PENDING` - PENDING\n* `RECEIVED` - RECEIVED\n* `RETRY` - RETRY\n* `REVOKED` - REVOKED\n* `STARTED` - STARTED\n* `SUCCESS` - SUCCESS"]
9702 #[serde(default, skip_serializing_if = "Option::is_none")]
9703 pub status: Option<StatusEnum>,
9704 #[doc = "The data returned by the task"]
9705 #[serde(default, skip_serializing_if = "Option::is_none")]
9706 pub result: Option<String>,
9707 #[doc = "If the task is acknowledged via the frontend or API"]
9708 #[serde(default, skip_serializing_if = "Option::is_none")]
9709 pub acknowledged: Option<bool>,
9710 #[serde(default)]
9711 pub related_document: Option<String>,
9712 #[serde(default, skip_serializing_if = "Option::is_none")]
9713 pub owner: Option<i64>,
9714}
9715
9716impl std::fmt::Display for TasksView {
9717 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9718 write!(
9719 f,
9720 "{}",
9721 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9722 )
9723 }
9724}
9725
9726#[cfg(feature = "tabled")]
9727impl tabled::Tabled for TasksView {
9728 const LENGTH: usize = 12;
9729 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9730 vec![
9731 format!("{:?}", self.id).into(),
9732 self.task_id.clone().into(),
9733 if let Some(task_name) = &self.task_name {
9734 format!("{task_name:?}").into()
9735 } else {
9736 String::new().into()
9737 },
9738 if let Some(task_file_name) = &self.task_file_name {
9739 format!("{task_file_name:?}").into()
9740 } else {
9741 String::new().into()
9742 },
9743 if let Some(date_created) = &self.date_created {
9744 format!("{date_created:?}").into()
9745 } else {
9746 String::new().into()
9747 },
9748 if let Some(date_done) = &self.date_done {
9749 format!("{date_done:?}").into()
9750 } else {
9751 String::new().into()
9752 },
9753 if let Some(type_) = &self.type_ {
9754 format!("{type_:?}").into()
9755 } else {
9756 String::new().into()
9757 },
9758 if let Some(status) = &self.status {
9759 format!("{status:?}").into()
9760 } else {
9761 String::new().into()
9762 },
9763 if let Some(result) = &self.result {
9764 format!("{result:?}").into()
9765 } else {
9766 String::new().into()
9767 },
9768 if let Some(acknowledged) = &self.acknowledged {
9769 format!("{acknowledged:?}").into()
9770 } else {
9771 String::new().into()
9772 },
9773 format!("{:?}", self.related_document).into(),
9774 if let Some(owner) = &self.owner {
9775 format!("{owner:?}").into()
9776 } else {
9777 String::new().into()
9778 },
9779 ]
9780 }
9781
9782 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9783 vec![
9784 "id".into(),
9785 "task_id".into(),
9786 "task_name".into(),
9787 "task_file_name".into(),
9788 "date_created".into(),
9789 "date_done".into(),
9790 "type_".into(),
9791 "status".into(),
9792 "result".into(),
9793 "acknowledged".into(),
9794 "related_document".into(),
9795 "owner".into(),
9796 ]
9797 }
9798}
9799
9800#[derive(
9801 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9802)]
9803#[allow(non_snake_case)]
9804pub struct TasksViewRequest {
9805 #[doc = "Celery ID for the Task that was run"]
9806 pub task_id: String,
9807 #[doc = "Name of the task that was run\n\n* `consume_file` - Consume File\n* `train_classifier` - Train Classifier\n* `check_sanity` - Check Sanity\n* `index_optimize` - Index Optimize"]
9808 #[serde(default, skip_serializing_if = "Option::is_none")]
9809 pub task_name: Option<TaskName>,
9810 #[doc = "Name of the file which the Task was run for"]
9811 #[serde(default, skip_serializing_if = "Option::is_none")]
9812 pub task_file_name: Option<String>,
9813 #[doc = "Datetime field when the task result was created in UTC"]
9814 #[serde(default, skip_serializing_if = "Option::is_none")]
9815 pub date_created: Option<chrono::DateTime<chrono::Utc>>,
9816 #[doc = "Datetime field when the task was completed in UTC"]
9817 #[serde(default, skip_serializing_if = "Option::is_none")]
9818 pub date_done: Option<chrono::DateTime<chrono::Utc>>,
9819 #[doc = "The type of task that was run\n\n* `auto_task` - Auto Task\n* `scheduled_task` - Scheduled Task\n* `manual_task` - Manual Task"]
9820 #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
9821 pub type_: Option<TasksViewTypeEnum>,
9822 #[doc = "Current state of the task being run\n\n* `FAILURE` - FAILURE\n* `PENDING` - PENDING\n* `RECEIVED` - RECEIVED\n* `RETRY` - RETRY\n* `REVOKED` - REVOKED\n* `STARTED` - STARTED\n* `SUCCESS` - SUCCESS"]
9823 #[serde(default, skip_serializing_if = "Option::is_none")]
9824 pub status: Option<StatusEnum>,
9825 #[doc = "The data returned by the task"]
9826 #[serde(default, skip_serializing_if = "Option::is_none")]
9827 pub result: Option<String>,
9828 #[doc = "If the task is acknowledged via the frontend or API"]
9829 #[serde(default, skip_serializing_if = "Option::is_none")]
9830 pub acknowledged: Option<bool>,
9831 #[serde(default, skip_serializing_if = "Option::is_none")]
9832 pub owner: Option<i64>,
9833}
9834
9835impl std::fmt::Display for TasksViewRequest {
9836 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9837 write!(
9838 f,
9839 "{}",
9840 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9841 )
9842 }
9843}
9844
9845#[cfg(feature = "tabled")]
9846impl tabled::Tabled for TasksViewRequest {
9847 const LENGTH: usize = 10;
9848 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9849 vec![
9850 self.task_id.clone().into(),
9851 if let Some(task_name) = &self.task_name {
9852 format!("{task_name:?}").into()
9853 } else {
9854 String::new().into()
9855 },
9856 if let Some(task_file_name) = &self.task_file_name {
9857 format!("{task_file_name:?}").into()
9858 } else {
9859 String::new().into()
9860 },
9861 if let Some(date_created) = &self.date_created {
9862 format!("{date_created:?}").into()
9863 } else {
9864 String::new().into()
9865 },
9866 if let Some(date_done) = &self.date_done {
9867 format!("{date_done:?}").into()
9868 } else {
9869 String::new().into()
9870 },
9871 if let Some(type_) = &self.type_ {
9872 format!("{type_:?}").into()
9873 } else {
9874 String::new().into()
9875 },
9876 if let Some(status) = &self.status {
9877 format!("{status:?}").into()
9878 } else {
9879 String::new().into()
9880 },
9881 if let Some(result) = &self.result {
9882 format!("{result:?}").into()
9883 } else {
9884 String::new().into()
9885 },
9886 if let Some(acknowledged) = &self.acknowledged {
9887 format!("{acknowledged:?}").into()
9888 } else {
9889 String::new().into()
9890 },
9891 if let Some(owner) = &self.owner {
9892 format!("{owner:?}").into()
9893 } else {
9894 String::new().into()
9895 },
9896 ]
9897 }
9898
9899 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9900 vec![
9901 "task_id".into(),
9902 "task_name".into(),
9903 "task_file_name".into(),
9904 "date_created".into(),
9905 "date_done".into(),
9906 "type_".into(),
9907 "status".into(),
9908 "result".into(),
9909 "acknowledged".into(),
9910 "owner".into(),
9911 ]
9912 }
9913}
9914
9915#[doc = "* `auto_task` - Auto Task\n* `scheduled_task` - Scheduled Task\n* `manual_task` - Manual Task"]
9916#[derive(
9917 serde :: Serialize,
9918 serde :: Deserialize,
9919 PartialEq,
9920 Hash,
9921 Debug,
9922 Clone,
9923 schemars :: JsonSchema,
9924 parse_display :: FromStr,
9925 parse_display :: Display,
9926)]
9927#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
9928#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
9929pub enum TasksViewTypeEnum {
9930 #[serde(rename = "auto_task")]
9931 #[display("auto_task")]
9932 AutoTask,
9933 #[serde(rename = "scheduled_task")]
9934 #[display("scheduled_task")]
9935 ScheduledTask,
9936 #[serde(rename = "manual_task")]
9937 #[display("manual_task")]
9938 ManualTask,
9939}
9940
9941#[doc = "* `restore` - restore\n* `empty` - empty"]
9942#[derive(
9943 serde :: Serialize,
9944 serde :: Deserialize,
9945 PartialEq,
9946 Hash,
9947 Debug,
9948 Clone,
9949 schemars :: JsonSchema,
9950 parse_display :: FromStr,
9951 parse_display :: Display,
9952)]
9953#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
9954#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
9955pub enum TrashActionEnum {
9956 #[serde(rename = "restore")]
9957 #[display("restore")]
9958 Restore,
9959 #[serde(rename = "empty")]
9960 #[display("empty")]
9961 Empty,
9962}
9963
9964#[derive(
9965 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
9966)]
9967#[allow(non_snake_case)]
9968pub struct TrashRequest {
9969 #[serde(default, skip_serializing_if = "Option::is_none")]
9970 pub documents: Option<Vec<i64>>,
9971 pub action: TrashActionEnum,
9972}
9973
9974impl std::fmt::Display for TrashRequest {
9975 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
9976 write!(
9977 f,
9978 "{}",
9979 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
9980 )
9981 }
9982}
9983
9984#[cfg(feature = "tabled")]
9985impl tabled::Tabled for TrashRequest {
9986 const LENGTH: usize = 2;
9987 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
9988 vec![
9989 if let Some(documents) = &self.documents {
9990 format!("{documents:?}").into()
9991 } else {
9992 String::new().into()
9993 },
9994 format!("{:?}", self.action).into(),
9995 ]
9996 }
9997
9998 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
9999 vec!["documents".into(), "action".into()]
10000 }
10001}
10002
10003#[derive(
10004 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10005)]
10006#[allow(non_snake_case)]
10007pub struct UiSettingsView {
10008 pub id: i64,
10009 #[serde(default, skip_serializing_if = "Option::is_none")]
10010 pub settings: Option<std::collections::HashMap<String, serde_json::Value>>,
10011}
10012
10013impl std::fmt::Display for UiSettingsView {
10014 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10015 write!(
10016 f,
10017 "{}",
10018 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10019 )
10020 }
10021}
10022
10023#[cfg(feature = "tabled")]
10024impl tabled::Tabled for UiSettingsView {
10025 const LENGTH: usize = 2;
10026 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10027 vec![
10028 format!("{:?}", self.id).into(),
10029 if let Some(settings) = &self.settings {
10030 format!("{settings:?}").into()
10031 } else {
10032 String::new().into()
10033 },
10034 ]
10035 }
10036
10037 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
10038 vec!["id".into(), "settings".into()]
10039 }
10040}
10041
10042#[derive(
10043 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10044)]
10045#[allow(non_snake_case)]
10046pub struct UiSettingsViewRequest {
10047 #[serde(default, skip_serializing_if = "Option::is_none")]
10048 pub settings: Option<std::collections::HashMap<String, serde_json::Value>>,
10049}
10050
10051impl std::fmt::Display for UiSettingsViewRequest {
10052 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10053 write!(
10054 f,
10055 "{}",
10056 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10057 )
10058 }
10059}
10060
10061#[cfg(feature = "tabled")]
10062impl tabled::Tabled for UiSettingsViewRequest {
10063 const LENGTH: usize = 1;
10064 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10065 vec![if let Some(settings) = &self.settings {
10066 format!("{settings:?}").into()
10067 } else {
10068 String::new().into()
10069 }]
10070 }
10071
10072 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
10073 vec!["settings".into()]
10074 }
10075}
10076
10077#[doc = "* `clean` - clean\n* `clean-final` - clean-final\n* `none` - none"]
10078#[derive(
10079 serde :: Serialize,
10080 serde :: Deserialize,
10081 PartialEq,
10082 Hash,
10083 Debug,
10084 Clone,
10085 schemars :: JsonSchema,
10086 parse_display :: FromStr,
10087 parse_display :: Display,
10088)]
10089#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
10090#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
10091pub enum UnpaperCleanEnum {
10092 #[serde(rename = "clean")]
10093 #[display("clean")]
10094 Clean,
10095 #[serde(rename = "clean-final")]
10096 #[display("clean-final")]
10097 CleanFinal,
10098 #[serde(rename = "none")]
10099 #[display("none")]
10100 None,
10101 #[serde(rename = "")]
10102 #[display("")]
10103 Empty,
10104}
10105
10106#[derive(
10107 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10108)]
10109#[allow(non_snake_case)]
10110pub struct User {
10111 pub id: i64,
10112 #[doc = "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."]
10113 pub username: String,
10114 #[serde(default, skip_serializing_if = "Option::is_none")]
10115 pub email: Option<String>,
10116 #[serde(default, skip_serializing_if = "Option::is_none")]
10117 pub password: Option<String>,
10118 #[serde(default, skip_serializing_if = "Option::is_none")]
10119 pub first_name: Option<String>,
10120 #[serde(default, skip_serializing_if = "Option::is_none")]
10121 pub last_name: Option<String>,
10122 #[serde(default, skip_serializing_if = "Option::is_none")]
10123 pub date_joined: Option<chrono::DateTime<chrono::Utc>>,
10124 #[doc = "Designates whether the user can log into this admin site."]
10125 #[serde(default, skip_serializing_if = "Option::is_none")]
10126 pub is_staff: Option<bool>,
10127 #[doc = "Designates whether this user should be treated as active. Unselect this instead of deleting accounts."]
10128 #[serde(default, skip_serializing_if = "Option::is_none")]
10129 pub is_active: Option<bool>,
10130 #[doc = "Designates that this user has all permissions without explicitly assigning them."]
10131 #[serde(default, skip_serializing_if = "Option::is_none")]
10132 pub is_superuser: Option<bool>,
10133 #[doc = "The groups this user belongs to. A user will get all permissions granted to each of their groups."]
10134 #[serde(default, skip_serializing_if = "Option::is_none")]
10135 pub groups: Option<Vec<i64>>,
10136 #[serde(default, skip_serializing_if = "Option::is_none")]
10137 pub user_permissions: Option<Vec<String>>,
10138 pub inherited_permissions: Vec<String>,
10139 pub is_mfa_enabled: bool,
10140}
10141
10142impl std::fmt::Display for User {
10143 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10144 write!(
10145 f,
10146 "{}",
10147 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10148 )
10149 }
10150}
10151
10152#[cfg(feature = "tabled")]
10153impl tabled::Tabled for User {
10154 const LENGTH: usize = 14;
10155 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10156 vec![
10157 format!("{:?}", self.id).into(),
10158 self.username.clone().into(),
10159 if let Some(email) = &self.email {
10160 format!("{email:?}").into()
10161 } else {
10162 String::new().into()
10163 },
10164 if let Some(password) = &self.password {
10165 format!("{password:?}").into()
10166 } else {
10167 String::new().into()
10168 },
10169 if let Some(first_name) = &self.first_name {
10170 format!("{first_name:?}").into()
10171 } else {
10172 String::new().into()
10173 },
10174 if let Some(last_name) = &self.last_name {
10175 format!("{last_name:?}").into()
10176 } else {
10177 String::new().into()
10178 },
10179 if let Some(date_joined) = &self.date_joined {
10180 format!("{date_joined:?}").into()
10181 } else {
10182 String::new().into()
10183 },
10184 if let Some(is_staff) = &self.is_staff {
10185 format!("{is_staff:?}").into()
10186 } else {
10187 String::new().into()
10188 },
10189 if let Some(is_active) = &self.is_active {
10190 format!("{is_active:?}").into()
10191 } else {
10192 String::new().into()
10193 },
10194 if let Some(is_superuser) = &self.is_superuser {
10195 format!("{is_superuser:?}").into()
10196 } else {
10197 String::new().into()
10198 },
10199 if let Some(groups) = &self.groups {
10200 format!("{groups:?}").into()
10201 } else {
10202 String::new().into()
10203 },
10204 if let Some(user_permissions) = &self.user_permissions {
10205 format!("{user_permissions:?}").into()
10206 } else {
10207 String::new().into()
10208 },
10209 format!("{:?}", self.inherited_permissions).into(),
10210 format!("{:?}", self.is_mfa_enabled).into(),
10211 ]
10212 }
10213
10214 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
10215 vec![
10216 "id".into(),
10217 "username".into(),
10218 "email".into(),
10219 "password".into(),
10220 "first_name".into(),
10221 "last_name".into(),
10222 "date_joined".into(),
10223 "is_staff".into(),
10224 "is_active".into(),
10225 "is_superuser".into(),
10226 "groups".into(),
10227 "user_permissions".into(),
10228 "inherited_permissions".into(),
10229 "is_mfa_enabled".into(),
10230 ]
10231 }
10232}
10233
10234#[derive(
10235 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10236)]
10237#[allow(non_snake_case)]
10238pub struct UserRequest {
10239 #[doc = "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only."]
10240 pub username: String,
10241 #[serde(default, skip_serializing_if = "Option::is_none")]
10242 pub email: Option<String>,
10243 #[serde(default, skip_serializing_if = "Option::is_none")]
10244 pub password: Option<String>,
10245 #[serde(default, skip_serializing_if = "Option::is_none")]
10246 pub first_name: Option<String>,
10247 #[serde(default, skip_serializing_if = "Option::is_none")]
10248 pub last_name: Option<String>,
10249 #[serde(default, skip_serializing_if = "Option::is_none")]
10250 pub date_joined: Option<chrono::DateTime<chrono::Utc>>,
10251 #[doc = "Designates whether the user can log into this admin site."]
10252 #[serde(default, skip_serializing_if = "Option::is_none")]
10253 pub is_staff: Option<bool>,
10254 #[doc = "Designates whether this user should be treated as active. Unselect this instead of deleting accounts."]
10255 #[serde(default, skip_serializing_if = "Option::is_none")]
10256 pub is_active: Option<bool>,
10257 #[doc = "Designates that this user has all permissions without explicitly assigning them."]
10258 #[serde(default, skip_serializing_if = "Option::is_none")]
10259 pub is_superuser: Option<bool>,
10260 #[doc = "The groups this user belongs to. A user will get all permissions granted to each of their groups."]
10261 #[serde(default, skip_serializing_if = "Option::is_none")]
10262 pub groups: Option<Vec<i64>>,
10263 #[serde(default, skip_serializing_if = "Option::is_none")]
10264 pub user_permissions: Option<Vec<String>>,
10265}
10266
10267impl std::fmt::Display for UserRequest {
10268 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10269 write!(
10270 f,
10271 "{}",
10272 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10273 )
10274 }
10275}
10276
10277#[cfg(feature = "tabled")]
10278impl tabled::Tabled for UserRequest {
10279 const LENGTH: usize = 11;
10280 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10281 vec![
10282 self.username.clone().into(),
10283 if let Some(email) = &self.email {
10284 format!("{email:?}").into()
10285 } else {
10286 String::new().into()
10287 },
10288 if let Some(password) = &self.password {
10289 format!("{password:?}").into()
10290 } else {
10291 String::new().into()
10292 },
10293 if let Some(first_name) = &self.first_name {
10294 format!("{first_name:?}").into()
10295 } else {
10296 String::new().into()
10297 },
10298 if let Some(last_name) = &self.last_name {
10299 format!("{last_name:?}").into()
10300 } else {
10301 String::new().into()
10302 },
10303 if let Some(date_joined) = &self.date_joined {
10304 format!("{date_joined:?}").into()
10305 } else {
10306 String::new().into()
10307 },
10308 if let Some(is_staff) = &self.is_staff {
10309 format!("{is_staff:?}").into()
10310 } else {
10311 String::new().into()
10312 },
10313 if let Some(is_active) = &self.is_active {
10314 format!("{is_active:?}").into()
10315 } else {
10316 String::new().into()
10317 },
10318 if let Some(is_superuser) = &self.is_superuser {
10319 format!("{is_superuser:?}").into()
10320 } else {
10321 String::new().into()
10322 },
10323 if let Some(groups) = &self.groups {
10324 format!("{groups:?}").into()
10325 } else {
10326 String::new().into()
10327 },
10328 if let Some(user_permissions) = &self.user_permissions {
10329 format!("{user_permissions:?}").into()
10330 } else {
10331 String::new().into()
10332 },
10333 ]
10334 }
10335
10336 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
10337 vec![
10338 "username".into(),
10339 "email".into(),
10340 "password".into(),
10341 "first_name".into(),
10342 "last_name".into(),
10343 "date_joined".into(),
10344 "is_staff".into(),
10345 "is_active".into(),
10346 "is_superuser".into(),
10347 "groups".into(),
10348 "user_permissions".into(),
10349 ]
10350 }
10351}
10352
10353#[derive(
10354 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10355)]
10356#[allow(non_snake_case)]
10357pub struct Workflow {
10358 pub id: i64,
10359 pub name: String,
10360 #[serde(default, skip_serializing_if = "Option::is_none")]
10361 pub order: Option<i64>,
10362 #[serde(default, skip_serializing_if = "Option::is_none")]
10363 pub enabled: Option<bool>,
10364 pub triggers: Vec<WorkflowTrigger>,
10365 pub actions: Vec<WorkflowAction>,
10366}
10367
10368impl std::fmt::Display for Workflow {
10369 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10370 write!(
10371 f,
10372 "{}",
10373 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10374 )
10375 }
10376}
10377
10378#[cfg(feature = "tabled")]
10379impl tabled::Tabled for Workflow {
10380 const LENGTH: usize = 6;
10381 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10382 vec![
10383 format!("{:?}", self.id).into(),
10384 self.name.clone().into(),
10385 if let Some(order) = &self.order {
10386 format!("{order:?}").into()
10387 } else {
10388 String::new().into()
10389 },
10390 if let Some(enabled) = &self.enabled {
10391 format!("{enabled:?}").into()
10392 } else {
10393 String::new().into()
10394 },
10395 format!("{:?}", self.triggers).into(),
10396 format!("{:?}", self.actions).into(),
10397 ]
10398 }
10399
10400 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
10401 vec![
10402 "id".into(),
10403 "name".into(),
10404 "order".into(),
10405 "enabled".into(),
10406 "triggers".into(),
10407 "actions".into(),
10408 ]
10409 }
10410}
10411
10412#[derive(
10413 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10414)]
10415#[allow(non_snake_case)]
10416pub struct WorkflowAction {
10417 #[serde(default, skip_serializing_if = "Option::is_none")]
10418 pub id: Option<i64>,
10419 #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
10420 pub type_: Option<i64>,
10421 #[doc = "Assign a document title, can include some placeholders, see documentation."]
10422 #[serde(default, skip_serializing_if = "Option::is_none")]
10423 pub assign_title: Option<String>,
10424 #[serde(default, skip_serializing_if = "Option::is_none")]
10425 pub assign_tags: Option<Vec<Option<i64>>>,
10426 #[serde(default, skip_serializing_if = "Option::is_none")]
10427 pub assign_correspondent: Option<i64>,
10428 #[serde(default, skip_serializing_if = "Option::is_none")]
10429 pub assign_document_type: Option<i64>,
10430 #[serde(default, skip_serializing_if = "Option::is_none")]
10431 pub assign_storage_path: Option<i64>,
10432 #[serde(default, skip_serializing_if = "Option::is_none")]
10433 pub assign_owner: Option<i64>,
10434 #[serde(default, skip_serializing_if = "Option::is_none")]
10435 pub assign_view_users: Option<Vec<i64>>,
10436 #[serde(default, skip_serializing_if = "Option::is_none")]
10437 pub assign_view_groups: Option<Vec<i64>>,
10438 #[serde(default, skip_serializing_if = "Option::is_none")]
10439 pub assign_change_users: Option<Vec<i64>>,
10440 #[serde(default, skip_serializing_if = "Option::is_none")]
10441 pub assign_change_groups: Option<Vec<i64>>,
10442 #[serde(default, skip_serializing_if = "Option::is_none")]
10443 pub assign_custom_fields: Option<Vec<i64>>,
10444 #[doc = "Optional values to assign to the custom fields."]
10445 #[serde(default, skip_serializing_if = "Option::is_none")]
10446 pub assign_custom_fields_values: Option<serde_json::Value>,
10447 #[serde(default, skip_serializing_if = "Option::is_none")]
10448 pub remove_all_tags: Option<bool>,
10449 #[serde(default, skip_serializing_if = "Option::is_none")]
10450 pub remove_tags: Option<Vec<i64>>,
10451 #[serde(default, skip_serializing_if = "Option::is_none")]
10452 pub remove_all_correspondents: Option<bool>,
10453 #[serde(default, skip_serializing_if = "Option::is_none")]
10454 pub remove_correspondents: Option<Vec<i64>>,
10455 #[serde(default, skip_serializing_if = "Option::is_none")]
10456 pub remove_all_document_types: Option<bool>,
10457 #[serde(default, skip_serializing_if = "Option::is_none")]
10458 pub remove_document_types: Option<Vec<i64>>,
10459 #[serde(default, skip_serializing_if = "Option::is_none")]
10460 pub remove_all_storage_paths: Option<bool>,
10461 #[serde(default, skip_serializing_if = "Option::is_none")]
10462 pub remove_storage_paths: Option<Vec<i64>>,
10463 #[serde(default, skip_serializing_if = "Option::is_none")]
10464 pub remove_custom_fields: Option<Vec<i64>>,
10465 #[serde(default, skip_serializing_if = "Option::is_none")]
10466 pub remove_all_custom_fields: Option<bool>,
10467 #[serde(default, skip_serializing_if = "Option::is_none")]
10468 pub remove_all_owners: Option<bool>,
10469 #[serde(default, skip_serializing_if = "Option::is_none")]
10470 pub remove_owners: Option<Vec<i64>>,
10471 #[serde(default, skip_serializing_if = "Option::is_none")]
10472 pub remove_all_permissions: Option<bool>,
10473 #[serde(default, skip_serializing_if = "Option::is_none")]
10474 pub remove_view_users: Option<Vec<i64>>,
10475 #[serde(default, skip_serializing_if = "Option::is_none")]
10476 pub remove_view_groups: Option<Vec<i64>>,
10477 #[serde(default, skip_serializing_if = "Option::is_none")]
10478 pub remove_change_users: Option<Vec<i64>>,
10479 #[serde(default, skip_serializing_if = "Option::is_none")]
10480 pub remove_change_groups: Option<Vec<i64>>,
10481 #[serde(default, skip_serializing_if = "Option::is_none")]
10482 pub email: Option<WorkflowActionEmail>,
10483 #[serde(default, skip_serializing_if = "Option::is_none")]
10484 pub webhook: Option<WorkflowActionWebhook>,
10485}
10486
10487impl std::fmt::Display for WorkflowAction {
10488 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10489 write!(
10490 f,
10491 "{}",
10492 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10493 )
10494 }
10495}
10496
10497#[cfg(feature = "tabled")]
10498impl tabled::Tabled for WorkflowAction {
10499 const LENGTH: usize = 33;
10500 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10501 vec![
10502 if let Some(id) = &self.id {
10503 format!("{id:?}").into()
10504 } else {
10505 String::new().into()
10506 },
10507 if let Some(type_) = &self.type_ {
10508 format!("{type_:?}").into()
10509 } else {
10510 String::new().into()
10511 },
10512 if let Some(assign_title) = &self.assign_title {
10513 format!("{assign_title:?}").into()
10514 } else {
10515 String::new().into()
10516 },
10517 if let Some(assign_tags) = &self.assign_tags {
10518 format!("{assign_tags:?}").into()
10519 } else {
10520 String::new().into()
10521 },
10522 if let Some(assign_correspondent) = &self.assign_correspondent {
10523 format!("{assign_correspondent:?}").into()
10524 } else {
10525 String::new().into()
10526 },
10527 if let Some(assign_document_type) = &self.assign_document_type {
10528 format!("{assign_document_type:?}").into()
10529 } else {
10530 String::new().into()
10531 },
10532 if let Some(assign_storage_path) = &self.assign_storage_path {
10533 format!("{assign_storage_path:?}").into()
10534 } else {
10535 String::new().into()
10536 },
10537 if let Some(assign_owner) = &self.assign_owner {
10538 format!("{assign_owner:?}").into()
10539 } else {
10540 String::new().into()
10541 },
10542 if let Some(assign_view_users) = &self.assign_view_users {
10543 format!("{assign_view_users:?}").into()
10544 } else {
10545 String::new().into()
10546 },
10547 if let Some(assign_view_groups) = &self.assign_view_groups {
10548 format!("{assign_view_groups:?}").into()
10549 } else {
10550 String::new().into()
10551 },
10552 if let Some(assign_change_users) = &self.assign_change_users {
10553 format!("{assign_change_users:?}").into()
10554 } else {
10555 String::new().into()
10556 },
10557 if let Some(assign_change_groups) = &self.assign_change_groups {
10558 format!("{assign_change_groups:?}").into()
10559 } else {
10560 String::new().into()
10561 },
10562 if let Some(assign_custom_fields) = &self.assign_custom_fields {
10563 format!("{assign_custom_fields:?}").into()
10564 } else {
10565 String::new().into()
10566 },
10567 if let Some(assign_custom_fields_values) = &self.assign_custom_fields_values {
10568 format!("{assign_custom_fields_values:?}").into()
10569 } else {
10570 String::new().into()
10571 },
10572 if let Some(remove_all_tags) = &self.remove_all_tags {
10573 format!("{remove_all_tags:?}").into()
10574 } else {
10575 String::new().into()
10576 },
10577 if let Some(remove_tags) = &self.remove_tags {
10578 format!("{remove_tags:?}").into()
10579 } else {
10580 String::new().into()
10581 },
10582 if let Some(remove_all_correspondents) = &self.remove_all_correspondents {
10583 format!("{remove_all_correspondents:?}").into()
10584 } else {
10585 String::new().into()
10586 },
10587 if let Some(remove_correspondents) = &self.remove_correspondents {
10588 format!("{remove_correspondents:?}").into()
10589 } else {
10590 String::new().into()
10591 },
10592 if let Some(remove_all_document_types) = &self.remove_all_document_types {
10593 format!("{remove_all_document_types:?}").into()
10594 } else {
10595 String::new().into()
10596 },
10597 if let Some(remove_document_types) = &self.remove_document_types {
10598 format!("{remove_document_types:?}").into()
10599 } else {
10600 String::new().into()
10601 },
10602 if let Some(remove_all_storage_paths) = &self.remove_all_storage_paths {
10603 format!("{remove_all_storage_paths:?}").into()
10604 } else {
10605 String::new().into()
10606 },
10607 if let Some(remove_storage_paths) = &self.remove_storage_paths {
10608 format!("{remove_storage_paths:?}").into()
10609 } else {
10610 String::new().into()
10611 },
10612 if let Some(remove_custom_fields) = &self.remove_custom_fields {
10613 format!("{remove_custom_fields:?}").into()
10614 } else {
10615 String::new().into()
10616 },
10617 if let Some(remove_all_custom_fields) = &self.remove_all_custom_fields {
10618 format!("{remove_all_custom_fields:?}").into()
10619 } else {
10620 String::new().into()
10621 },
10622 if let Some(remove_all_owners) = &self.remove_all_owners {
10623 format!("{remove_all_owners:?}").into()
10624 } else {
10625 String::new().into()
10626 },
10627 if let Some(remove_owners) = &self.remove_owners {
10628 format!("{remove_owners:?}").into()
10629 } else {
10630 String::new().into()
10631 },
10632 if let Some(remove_all_permissions) = &self.remove_all_permissions {
10633 format!("{remove_all_permissions:?}").into()
10634 } else {
10635 String::new().into()
10636 },
10637 if let Some(remove_view_users) = &self.remove_view_users {
10638 format!("{remove_view_users:?}").into()
10639 } else {
10640 String::new().into()
10641 },
10642 if let Some(remove_view_groups) = &self.remove_view_groups {
10643 format!("{remove_view_groups:?}").into()
10644 } else {
10645 String::new().into()
10646 },
10647 if let Some(remove_change_users) = &self.remove_change_users {
10648 format!("{remove_change_users:?}").into()
10649 } else {
10650 String::new().into()
10651 },
10652 if let Some(remove_change_groups) = &self.remove_change_groups {
10653 format!("{remove_change_groups:?}").into()
10654 } else {
10655 String::new().into()
10656 },
10657 if let Some(email) = &self.email {
10658 format!("{email:?}").into()
10659 } else {
10660 String::new().into()
10661 },
10662 if let Some(webhook) = &self.webhook {
10663 format!("{webhook:?}").into()
10664 } else {
10665 String::new().into()
10666 },
10667 ]
10668 }
10669
10670 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
10671 vec![
10672 "id".into(),
10673 "type_".into(),
10674 "assign_title".into(),
10675 "assign_tags".into(),
10676 "assign_correspondent".into(),
10677 "assign_document_type".into(),
10678 "assign_storage_path".into(),
10679 "assign_owner".into(),
10680 "assign_view_users".into(),
10681 "assign_view_groups".into(),
10682 "assign_change_users".into(),
10683 "assign_change_groups".into(),
10684 "assign_custom_fields".into(),
10685 "assign_custom_fields_values".into(),
10686 "remove_all_tags".into(),
10687 "remove_tags".into(),
10688 "remove_all_correspondents".into(),
10689 "remove_correspondents".into(),
10690 "remove_all_document_types".into(),
10691 "remove_document_types".into(),
10692 "remove_all_storage_paths".into(),
10693 "remove_storage_paths".into(),
10694 "remove_custom_fields".into(),
10695 "remove_all_custom_fields".into(),
10696 "remove_all_owners".into(),
10697 "remove_owners".into(),
10698 "remove_all_permissions".into(),
10699 "remove_view_users".into(),
10700 "remove_view_groups".into(),
10701 "remove_change_users".into(),
10702 "remove_change_groups".into(),
10703 "email".into(),
10704 "webhook".into(),
10705 ]
10706 }
10707}
10708
10709#[derive(
10710 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10711)]
10712#[allow(non_snake_case)]
10713pub struct WorkflowActionEmail {
10714 #[serde(default, skip_serializing_if = "Option::is_none")]
10715 pub id: Option<i64>,
10716 #[doc = "The subject of the email, can include some placeholders, see documentation."]
10717 pub subject: String,
10718 #[doc = "The body (message) of the email, can include some placeholders, see documentation."]
10719 pub body: String,
10720 #[doc = "The destination email addresses, comma separated."]
10721 pub to: String,
10722 #[serde(default, skip_serializing_if = "Option::is_none")]
10723 pub include_document: Option<bool>,
10724}
10725
10726impl std::fmt::Display for WorkflowActionEmail {
10727 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10728 write!(
10729 f,
10730 "{}",
10731 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10732 )
10733 }
10734}
10735
10736#[cfg(feature = "tabled")]
10737impl tabled::Tabled for WorkflowActionEmail {
10738 const LENGTH: usize = 5;
10739 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10740 vec![
10741 if let Some(id) = &self.id {
10742 format!("{id:?}").into()
10743 } else {
10744 String::new().into()
10745 },
10746 self.subject.clone().into(),
10747 self.body.clone().into(),
10748 self.to.clone().into(),
10749 if let Some(include_document) = &self.include_document {
10750 format!("{include_document:?}").into()
10751 } else {
10752 String::new().into()
10753 },
10754 ]
10755 }
10756
10757 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
10758 vec![
10759 "id".into(),
10760 "subject".into(),
10761 "body".into(),
10762 "to".into(),
10763 "include_document".into(),
10764 ]
10765 }
10766}
10767
10768#[derive(
10769 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10770)]
10771#[allow(non_snake_case)]
10772pub struct WorkflowActionEmailRequest {
10773 #[serde(default, skip_serializing_if = "Option::is_none")]
10774 pub id: Option<i64>,
10775 #[doc = "The subject of the email, can include some placeholders, see documentation."]
10776 pub subject: String,
10777 #[doc = "The body (message) of the email, can include some placeholders, see documentation."]
10778 pub body: String,
10779 #[doc = "The destination email addresses, comma separated."]
10780 pub to: String,
10781 #[serde(default, skip_serializing_if = "Option::is_none")]
10782 pub include_document: Option<bool>,
10783}
10784
10785impl std::fmt::Display for WorkflowActionEmailRequest {
10786 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10787 write!(
10788 f,
10789 "{}",
10790 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10791 )
10792 }
10793}
10794
10795#[cfg(feature = "tabled")]
10796impl tabled::Tabled for WorkflowActionEmailRequest {
10797 const LENGTH: usize = 5;
10798 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10799 vec![
10800 if let Some(id) = &self.id {
10801 format!("{id:?}").into()
10802 } else {
10803 String::new().into()
10804 },
10805 self.subject.clone().into(),
10806 self.body.clone().into(),
10807 self.to.clone().into(),
10808 if let Some(include_document) = &self.include_document {
10809 format!("{include_document:?}").into()
10810 } else {
10811 String::new().into()
10812 },
10813 ]
10814 }
10815
10816 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
10817 vec![
10818 "id".into(),
10819 "subject".into(),
10820 "body".into(),
10821 "to".into(),
10822 "include_document".into(),
10823 ]
10824 }
10825}
10826
10827#[derive(
10828 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
10829)]
10830#[allow(non_snake_case)]
10831pub struct WorkflowActionRequest {
10832 #[serde(default, skip_serializing_if = "Option::is_none")]
10833 pub id: Option<i64>,
10834 #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
10835 pub type_: Option<i64>,
10836 #[doc = "Assign a document title, can include some placeholders, see documentation."]
10837 #[serde(default, skip_serializing_if = "Option::is_none")]
10838 pub assign_title: Option<String>,
10839 #[serde(default, skip_serializing_if = "Option::is_none")]
10840 pub assign_tags: Option<Vec<Option<i64>>>,
10841 #[serde(default, skip_serializing_if = "Option::is_none")]
10842 pub assign_correspondent: Option<i64>,
10843 #[serde(default, skip_serializing_if = "Option::is_none")]
10844 pub assign_document_type: Option<i64>,
10845 #[serde(default, skip_serializing_if = "Option::is_none")]
10846 pub assign_storage_path: Option<i64>,
10847 #[serde(default, skip_serializing_if = "Option::is_none")]
10848 pub assign_owner: Option<i64>,
10849 #[serde(default, skip_serializing_if = "Option::is_none")]
10850 pub assign_view_users: Option<Vec<i64>>,
10851 #[serde(default, skip_serializing_if = "Option::is_none")]
10852 pub assign_view_groups: Option<Vec<i64>>,
10853 #[serde(default, skip_serializing_if = "Option::is_none")]
10854 pub assign_change_users: Option<Vec<i64>>,
10855 #[serde(default, skip_serializing_if = "Option::is_none")]
10856 pub assign_change_groups: Option<Vec<i64>>,
10857 #[serde(default, skip_serializing_if = "Option::is_none")]
10858 pub assign_custom_fields: Option<Vec<i64>>,
10859 #[doc = "Optional values to assign to the custom fields."]
10860 #[serde(default, skip_serializing_if = "Option::is_none")]
10861 pub assign_custom_fields_values: Option<serde_json::Value>,
10862 #[serde(default, skip_serializing_if = "Option::is_none")]
10863 pub remove_all_tags: Option<bool>,
10864 #[serde(default, skip_serializing_if = "Option::is_none")]
10865 pub remove_tags: Option<Vec<i64>>,
10866 #[serde(default, skip_serializing_if = "Option::is_none")]
10867 pub remove_all_correspondents: Option<bool>,
10868 #[serde(default, skip_serializing_if = "Option::is_none")]
10869 pub remove_correspondents: Option<Vec<i64>>,
10870 #[serde(default, skip_serializing_if = "Option::is_none")]
10871 pub remove_all_document_types: Option<bool>,
10872 #[serde(default, skip_serializing_if = "Option::is_none")]
10873 pub remove_document_types: Option<Vec<i64>>,
10874 #[serde(default, skip_serializing_if = "Option::is_none")]
10875 pub remove_all_storage_paths: Option<bool>,
10876 #[serde(default, skip_serializing_if = "Option::is_none")]
10877 pub remove_storage_paths: Option<Vec<i64>>,
10878 #[serde(default, skip_serializing_if = "Option::is_none")]
10879 pub remove_custom_fields: Option<Vec<i64>>,
10880 #[serde(default, skip_serializing_if = "Option::is_none")]
10881 pub remove_all_custom_fields: Option<bool>,
10882 #[serde(default, skip_serializing_if = "Option::is_none")]
10883 pub remove_all_owners: Option<bool>,
10884 #[serde(default, skip_serializing_if = "Option::is_none")]
10885 pub remove_owners: Option<Vec<i64>>,
10886 #[serde(default, skip_serializing_if = "Option::is_none")]
10887 pub remove_all_permissions: Option<bool>,
10888 #[serde(default, skip_serializing_if = "Option::is_none")]
10889 pub remove_view_users: Option<Vec<i64>>,
10890 #[serde(default, skip_serializing_if = "Option::is_none")]
10891 pub remove_view_groups: Option<Vec<i64>>,
10892 #[serde(default, skip_serializing_if = "Option::is_none")]
10893 pub remove_change_users: Option<Vec<i64>>,
10894 #[serde(default, skip_serializing_if = "Option::is_none")]
10895 pub remove_change_groups: Option<Vec<i64>>,
10896 #[serde(default, skip_serializing_if = "Option::is_none")]
10897 pub email: Option<WorkflowActionEmailRequest>,
10898 #[serde(default, skip_serializing_if = "Option::is_none")]
10899 pub webhook: Option<WorkflowActionWebhookRequest>,
10900}
10901
10902impl std::fmt::Display for WorkflowActionRequest {
10903 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
10904 write!(
10905 f,
10906 "{}",
10907 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
10908 )
10909 }
10910}
10911
10912#[cfg(feature = "tabled")]
10913impl tabled::Tabled for WorkflowActionRequest {
10914 const LENGTH: usize = 33;
10915 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
10916 vec![
10917 if let Some(id) = &self.id {
10918 format!("{id:?}").into()
10919 } else {
10920 String::new().into()
10921 },
10922 if let Some(type_) = &self.type_ {
10923 format!("{type_:?}").into()
10924 } else {
10925 String::new().into()
10926 },
10927 if let Some(assign_title) = &self.assign_title {
10928 format!("{assign_title:?}").into()
10929 } else {
10930 String::new().into()
10931 },
10932 if let Some(assign_tags) = &self.assign_tags {
10933 format!("{assign_tags:?}").into()
10934 } else {
10935 String::new().into()
10936 },
10937 if let Some(assign_correspondent) = &self.assign_correspondent {
10938 format!("{assign_correspondent:?}").into()
10939 } else {
10940 String::new().into()
10941 },
10942 if let Some(assign_document_type) = &self.assign_document_type {
10943 format!("{assign_document_type:?}").into()
10944 } else {
10945 String::new().into()
10946 },
10947 if let Some(assign_storage_path) = &self.assign_storage_path {
10948 format!("{assign_storage_path:?}").into()
10949 } else {
10950 String::new().into()
10951 },
10952 if let Some(assign_owner) = &self.assign_owner {
10953 format!("{assign_owner:?}").into()
10954 } else {
10955 String::new().into()
10956 },
10957 if let Some(assign_view_users) = &self.assign_view_users {
10958 format!("{assign_view_users:?}").into()
10959 } else {
10960 String::new().into()
10961 },
10962 if let Some(assign_view_groups) = &self.assign_view_groups {
10963 format!("{assign_view_groups:?}").into()
10964 } else {
10965 String::new().into()
10966 },
10967 if let Some(assign_change_users) = &self.assign_change_users {
10968 format!("{assign_change_users:?}").into()
10969 } else {
10970 String::new().into()
10971 },
10972 if let Some(assign_change_groups) = &self.assign_change_groups {
10973 format!("{assign_change_groups:?}").into()
10974 } else {
10975 String::new().into()
10976 },
10977 if let Some(assign_custom_fields) = &self.assign_custom_fields {
10978 format!("{assign_custom_fields:?}").into()
10979 } else {
10980 String::new().into()
10981 },
10982 if let Some(assign_custom_fields_values) = &self.assign_custom_fields_values {
10983 format!("{assign_custom_fields_values:?}").into()
10984 } else {
10985 String::new().into()
10986 },
10987 if let Some(remove_all_tags) = &self.remove_all_tags {
10988 format!("{remove_all_tags:?}").into()
10989 } else {
10990 String::new().into()
10991 },
10992 if let Some(remove_tags) = &self.remove_tags {
10993 format!("{remove_tags:?}").into()
10994 } else {
10995 String::new().into()
10996 },
10997 if let Some(remove_all_correspondents) = &self.remove_all_correspondents {
10998 format!("{remove_all_correspondents:?}").into()
10999 } else {
11000 String::new().into()
11001 },
11002 if let Some(remove_correspondents) = &self.remove_correspondents {
11003 format!("{remove_correspondents:?}").into()
11004 } else {
11005 String::new().into()
11006 },
11007 if let Some(remove_all_document_types) = &self.remove_all_document_types {
11008 format!("{remove_all_document_types:?}").into()
11009 } else {
11010 String::new().into()
11011 },
11012 if let Some(remove_document_types) = &self.remove_document_types {
11013 format!("{remove_document_types:?}").into()
11014 } else {
11015 String::new().into()
11016 },
11017 if let Some(remove_all_storage_paths) = &self.remove_all_storage_paths {
11018 format!("{remove_all_storage_paths:?}").into()
11019 } else {
11020 String::new().into()
11021 },
11022 if let Some(remove_storage_paths) = &self.remove_storage_paths {
11023 format!("{remove_storage_paths:?}").into()
11024 } else {
11025 String::new().into()
11026 },
11027 if let Some(remove_custom_fields) = &self.remove_custom_fields {
11028 format!("{remove_custom_fields:?}").into()
11029 } else {
11030 String::new().into()
11031 },
11032 if let Some(remove_all_custom_fields) = &self.remove_all_custom_fields {
11033 format!("{remove_all_custom_fields:?}").into()
11034 } else {
11035 String::new().into()
11036 },
11037 if let Some(remove_all_owners) = &self.remove_all_owners {
11038 format!("{remove_all_owners:?}").into()
11039 } else {
11040 String::new().into()
11041 },
11042 if let Some(remove_owners) = &self.remove_owners {
11043 format!("{remove_owners:?}").into()
11044 } else {
11045 String::new().into()
11046 },
11047 if let Some(remove_all_permissions) = &self.remove_all_permissions {
11048 format!("{remove_all_permissions:?}").into()
11049 } else {
11050 String::new().into()
11051 },
11052 if let Some(remove_view_users) = &self.remove_view_users {
11053 format!("{remove_view_users:?}").into()
11054 } else {
11055 String::new().into()
11056 },
11057 if let Some(remove_view_groups) = &self.remove_view_groups {
11058 format!("{remove_view_groups:?}").into()
11059 } else {
11060 String::new().into()
11061 },
11062 if let Some(remove_change_users) = &self.remove_change_users {
11063 format!("{remove_change_users:?}").into()
11064 } else {
11065 String::new().into()
11066 },
11067 if let Some(remove_change_groups) = &self.remove_change_groups {
11068 format!("{remove_change_groups:?}").into()
11069 } else {
11070 String::new().into()
11071 },
11072 if let Some(email) = &self.email {
11073 format!("{email:?}").into()
11074 } else {
11075 String::new().into()
11076 },
11077 if let Some(webhook) = &self.webhook {
11078 format!("{webhook:?}").into()
11079 } else {
11080 String::new().into()
11081 },
11082 ]
11083 }
11084
11085 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11086 vec![
11087 "id".into(),
11088 "type_".into(),
11089 "assign_title".into(),
11090 "assign_tags".into(),
11091 "assign_correspondent".into(),
11092 "assign_document_type".into(),
11093 "assign_storage_path".into(),
11094 "assign_owner".into(),
11095 "assign_view_users".into(),
11096 "assign_view_groups".into(),
11097 "assign_change_users".into(),
11098 "assign_change_groups".into(),
11099 "assign_custom_fields".into(),
11100 "assign_custom_fields_values".into(),
11101 "remove_all_tags".into(),
11102 "remove_tags".into(),
11103 "remove_all_correspondents".into(),
11104 "remove_correspondents".into(),
11105 "remove_all_document_types".into(),
11106 "remove_document_types".into(),
11107 "remove_all_storage_paths".into(),
11108 "remove_storage_paths".into(),
11109 "remove_custom_fields".into(),
11110 "remove_all_custom_fields".into(),
11111 "remove_all_owners".into(),
11112 "remove_owners".into(),
11113 "remove_all_permissions".into(),
11114 "remove_view_users".into(),
11115 "remove_view_groups".into(),
11116 "remove_change_users".into(),
11117 "remove_change_groups".into(),
11118 "email".into(),
11119 "webhook".into(),
11120 ]
11121 }
11122}
11123
11124#[derive(
11125 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11126)]
11127#[allow(non_snake_case)]
11128pub struct WorkflowActionWebhook {
11129 #[serde(default, skip_serializing_if = "Option::is_none")]
11130 pub id: Option<i64>,
11131 #[doc = "The destination URL for the notification."]
11132 pub url: String,
11133 #[serde(default, skip_serializing_if = "Option::is_none")]
11134 pub use_params: Option<bool>,
11135 #[serde(default, skip_serializing_if = "Option::is_none")]
11136 pub as_json: Option<bool>,
11137 #[doc = "The parameters to send with the webhook URL if body not used."]
11138 #[serde(default, skip_serializing_if = "Option::is_none")]
11139 pub params: Option<serde_json::Value>,
11140 #[doc = "The body to send with the webhook URL if parameters not used."]
11141 #[serde(default, skip_serializing_if = "Option::is_none")]
11142 pub body: Option<String>,
11143 #[doc = "The headers to send with the webhook URL."]
11144 #[serde(default, skip_serializing_if = "Option::is_none")]
11145 pub headers: Option<serde_json::Value>,
11146 #[serde(default, skip_serializing_if = "Option::is_none")]
11147 pub include_document: Option<bool>,
11148}
11149
11150impl std::fmt::Display for WorkflowActionWebhook {
11151 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11152 write!(
11153 f,
11154 "{}",
11155 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11156 )
11157 }
11158}
11159
11160#[cfg(feature = "tabled")]
11161impl tabled::Tabled for WorkflowActionWebhook {
11162 const LENGTH: usize = 8;
11163 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11164 vec![
11165 if let Some(id) = &self.id {
11166 format!("{id:?}").into()
11167 } else {
11168 String::new().into()
11169 },
11170 self.url.clone().into(),
11171 if let Some(use_params) = &self.use_params {
11172 format!("{use_params:?}").into()
11173 } else {
11174 String::new().into()
11175 },
11176 if let Some(as_json) = &self.as_json {
11177 format!("{as_json:?}").into()
11178 } else {
11179 String::new().into()
11180 },
11181 if let Some(params) = &self.params {
11182 format!("{params:?}").into()
11183 } else {
11184 String::new().into()
11185 },
11186 if let Some(body) = &self.body {
11187 format!("{body:?}").into()
11188 } else {
11189 String::new().into()
11190 },
11191 if let Some(headers) = &self.headers {
11192 format!("{headers:?}").into()
11193 } else {
11194 String::new().into()
11195 },
11196 if let Some(include_document) = &self.include_document {
11197 format!("{include_document:?}").into()
11198 } else {
11199 String::new().into()
11200 },
11201 ]
11202 }
11203
11204 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11205 vec![
11206 "id".into(),
11207 "url".into(),
11208 "use_params".into(),
11209 "as_json".into(),
11210 "params".into(),
11211 "body".into(),
11212 "headers".into(),
11213 "include_document".into(),
11214 ]
11215 }
11216}
11217
11218#[derive(
11219 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11220)]
11221#[allow(non_snake_case)]
11222pub struct WorkflowActionWebhookRequest {
11223 #[serde(default, skip_serializing_if = "Option::is_none")]
11224 pub id: Option<i64>,
11225 #[doc = "The destination URL for the notification."]
11226 pub url: String,
11227 #[serde(default, skip_serializing_if = "Option::is_none")]
11228 pub use_params: Option<bool>,
11229 #[serde(default, skip_serializing_if = "Option::is_none")]
11230 pub as_json: Option<bool>,
11231 #[doc = "The parameters to send with the webhook URL if body not used."]
11232 #[serde(default, skip_serializing_if = "Option::is_none")]
11233 pub params: Option<serde_json::Value>,
11234 #[doc = "The body to send with the webhook URL if parameters not used."]
11235 #[serde(default, skip_serializing_if = "Option::is_none")]
11236 pub body: Option<String>,
11237 #[doc = "The headers to send with the webhook URL."]
11238 #[serde(default, skip_serializing_if = "Option::is_none")]
11239 pub headers: Option<serde_json::Value>,
11240 #[serde(default, skip_serializing_if = "Option::is_none")]
11241 pub include_document: Option<bool>,
11242}
11243
11244impl std::fmt::Display for WorkflowActionWebhookRequest {
11245 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11246 write!(
11247 f,
11248 "{}",
11249 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11250 )
11251 }
11252}
11253
11254#[cfg(feature = "tabled")]
11255impl tabled::Tabled for WorkflowActionWebhookRequest {
11256 const LENGTH: usize = 8;
11257 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11258 vec![
11259 if let Some(id) = &self.id {
11260 format!("{id:?}").into()
11261 } else {
11262 String::new().into()
11263 },
11264 self.url.clone().into(),
11265 if let Some(use_params) = &self.use_params {
11266 format!("{use_params:?}").into()
11267 } else {
11268 String::new().into()
11269 },
11270 if let Some(as_json) = &self.as_json {
11271 format!("{as_json:?}").into()
11272 } else {
11273 String::new().into()
11274 },
11275 if let Some(params) = &self.params {
11276 format!("{params:?}").into()
11277 } else {
11278 String::new().into()
11279 },
11280 if let Some(body) = &self.body {
11281 format!("{body:?}").into()
11282 } else {
11283 String::new().into()
11284 },
11285 if let Some(headers) = &self.headers {
11286 format!("{headers:?}").into()
11287 } else {
11288 String::new().into()
11289 },
11290 if let Some(include_document) = &self.include_document {
11291 format!("{include_document:?}").into()
11292 } else {
11293 String::new().into()
11294 },
11295 ]
11296 }
11297
11298 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11299 vec![
11300 "id".into(),
11301 "url".into(),
11302 "use_params".into(),
11303 "as_json".into(),
11304 "params".into(),
11305 "body".into(),
11306 "headers".into(),
11307 "include_document".into(),
11308 ]
11309 }
11310}
11311
11312#[derive(
11313 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11314)]
11315#[allow(non_snake_case)]
11316pub struct WorkflowRequest {
11317 pub name: String,
11318 #[serde(default, skip_serializing_if = "Option::is_none")]
11319 pub order: Option<i64>,
11320 #[serde(default, skip_serializing_if = "Option::is_none")]
11321 pub enabled: Option<bool>,
11322 pub triggers: Vec<WorkflowTriggerRequest>,
11323 pub actions: Vec<WorkflowActionRequest>,
11324}
11325
11326impl std::fmt::Display for WorkflowRequest {
11327 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11328 write!(
11329 f,
11330 "{}",
11331 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11332 )
11333 }
11334}
11335
11336#[cfg(feature = "tabled")]
11337impl tabled::Tabled for WorkflowRequest {
11338 const LENGTH: usize = 5;
11339 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11340 vec![
11341 self.name.clone().into(),
11342 if let Some(order) = &self.order {
11343 format!("{order:?}").into()
11344 } else {
11345 String::new().into()
11346 },
11347 if let Some(enabled) = &self.enabled {
11348 format!("{enabled:?}").into()
11349 } else {
11350 String::new().into()
11351 },
11352 format!("{:?}", self.triggers).into(),
11353 format!("{:?}", self.actions).into(),
11354 ]
11355 }
11356
11357 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11358 vec![
11359 "name".into(),
11360 "order".into(),
11361 "enabled".into(),
11362 "triggers".into(),
11363 "actions".into(),
11364 ]
11365 }
11366}
11367
11368#[derive(
11369 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11370)]
11371#[allow(non_snake_case)]
11372pub struct WorkflowTrigger {
11373 #[serde(default, skip_serializing_if = "Option::is_none")]
11374 pub id: Option<i64>,
11375 #[serde(default)]
11376 pub sources: Vec<i64>,
11377 #[serde(rename = "type")]
11378 pub type_: i64,
11379 #[doc = "Only consume documents with a path that matches this if specified. Wildcards specified as * are allowed. Case insensitive."]
11380 #[serde(default, skip_serializing_if = "Option::is_none")]
11381 pub filter_path: Option<String>,
11382 #[doc = "Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
11383 #[serde(default, skip_serializing_if = "Option::is_none")]
11384 pub filter_filename: Option<String>,
11385 #[serde(default, skip_serializing_if = "Option::is_none")]
11386 pub filter_mailrule: Option<i64>,
11387 #[serde(default, skip_serializing_if = "Option::is_none")]
11388 pub matching_algorithm: Option<i64>,
11389 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
11390 pub match_: Option<String>,
11391 #[serde(default, skip_serializing_if = "Option::is_none")]
11392 pub is_insensitive: Option<bool>,
11393 #[serde(default, skip_serializing_if = "Option::is_none")]
11394 pub filter_has_tags: Option<Vec<i64>>,
11395 #[serde(default, skip_serializing_if = "Option::is_none")]
11396 pub filter_has_correspondent: Option<i64>,
11397 #[serde(default, skip_serializing_if = "Option::is_none")]
11398 pub filter_has_document_type: Option<i64>,
11399 #[doc = "The number of days to offset the schedule trigger by."]
11400 #[serde(default, skip_serializing_if = "Option::is_none")]
11401 pub schedule_offset_days: Option<i64>,
11402 #[doc = "If the schedule should be recurring."]
11403 #[serde(default, skip_serializing_if = "Option::is_none")]
11404 pub schedule_is_recurring: Option<bool>,
11405 #[doc = "The number of days between recurring schedule triggers."]
11406 #[serde(default, skip_serializing_if = "Option::is_none")]
11407 pub schedule_recurring_interval_days: Option<i64>,
11408 #[doc = "The field to check for a schedule trigger.\n\n* `added` - Added\n* `created` - Created\n* `modified` - Modified\n* `custom_field` - Custom Field"]
11409 #[serde(default, skip_serializing_if = "Option::is_none")]
11410 pub schedule_date_field: Option<ScheduleDateFieldEnum>,
11411 #[serde(default, skip_serializing_if = "Option::is_none")]
11412 pub schedule_date_custom_field: Option<i64>,
11413}
11414
11415impl std::fmt::Display for WorkflowTrigger {
11416 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11417 write!(
11418 f,
11419 "{}",
11420 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11421 )
11422 }
11423}
11424
11425#[cfg(feature = "tabled")]
11426impl tabled::Tabled for WorkflowTrigger {
11427 const LENGTH: usize = 17;
11428 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11429 vec![
11430 if let Some(id) = &self.id {
11431 format!("{id:?}").into()
11432 } else {
11433 String::new().into()
11434 },
11435 format!("{:?}", self.sources).into(),
11436 format!("{:?}", self.type_).into(),
11437 if let Some(filter_path) = &self.filter_path {
11438 format!("{filter_path:?}").into()
11439 } else {
11440 String::new().into()
11441 },
11442 if let Some(filter_filename) = &self.filter_filename {
11443 format!("{filter_filename:?}").into()
11444 } else {
11445 String::new().into()
11446 },
11447 if let Some(filter_mailrule) = &self.filter_mailrule {
11448 format!("{filter_mailrule:?}").into()
11449 } else {
11450 String::new().into()
11451 },
11452 if let Some(matching_algorithm) = &self.matching_algorithm {
11453 format!("{matching_algorithm:?}").into()
11454 } else {
11455 String::new().into()
11456 },
11457 if let Some(match_) = &self.match_ {
11458 format!("{match_:?}").into()
11459 } else {
11460 String::new().into()
11461 },
11462 if let Some(is_insensitive) = &self.is_insensitive {
11463 format!("{is_insensitive:?}").into()
11464 } else {
11465 String::new().into()
11466 },
11467 if let Some(filter_has_tags) = &self.filter_has_tags {
11468 format!("{filter_has_tags:?}").into()
11469 } else {
11470 String::new().into()
11471 },
11472 if let Some(filter_has_correspondent) = &self.filter_has_correspondent {
11473 format!("{filter_has_correspondent:?}").into()
11474 } else {
11475 String::new().into()
11476 },
11477 if let Some(filter_has_document_type) = &self.filter_has_document_type {
11478 format!("{filter_has_document_type:?}").into()
11479 } else {
11480 String::new().into()
11481 },
11482 if let Some(schedule_offset_days) = &self.schedule_offset_days {
11483 format!("{schedule_offset_days:?}").into()
11484 } else {
11485 String::new().into()
11486 },
11487 if let Some(schedule_is_recurring) = &self.schedule_is_recurring {
11488 format!("{schedule_is_recurring:?}").into()
11489 } else {
11490 String::new().into()
11491 },
11492 if let Some(schedule_recurring_interval_days) = &self.schedule_recurring_interval_days {
11493 format!("{schedule_recurring_interval_days:?}").into()
11494 } else {
11495 String::new().into()
11496 },
11497 if let Some(schedule_date_field) = &self.schedule_date_field {
11498 format!("{schedule_date_field:?}").into()
11499 } else {
11500 String::new().into()
11501 },
11502 if let Some(schedule_date_custom_field) = &self.schedule_date_custom_field {
11503 format!("{schedule_date_custom_field:?}").into()
11504 } else {
11505 String::new().into()
11506 },
11507 ]
11508 }
11509
11510 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11511 vec![
11512 "id".into(),
11513 "sources".into(),
11514 "type_".into(),
11515 "filter_path".into(),
11516 "filter_filename".into(),
11517 "filter_mailrule".into(),
11518 "matching_algorithm".into(),
11519 "match_".into(),
11520 "is_insensitive".into(),
11521 "filter_has_tags".into(),
11522 "filter_has_correspondent".into(),
11523 "filter_has_document_type".into(),
11524 "schedule_offset_days".into(),
11525 "schedule_is_recurring".into(),
11526 "schedule_recurring_interval_days".into(),
11527 "schedule_date_field".into(),
11528 "schedule_date_custom_field".into(),
11529 ]
11530 }
11531}
11532
11533#[derive(
11534 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11535)]
11536#[allow(non_snake_case)]
11537pub struct WorkflowTriggerRequest {
11538 #[serde(default, skip_serializing_if = "Option::is_none")]
11539 pub id: Option<i64>,
11540 #[serde(default)]
11541 pub sources: Vec<i64>,
11542 #[serde(rename = "type")]
11543 pub type_: i64,
11544 #[doc = "Only consume documents with a path that matches this if specified. Wildcards specified as * are allowed. Case insensitive."]
11545 #[serde(default, skip_serializing_if = "Option::is_none")]
11546 pub filter_path: Option<String>,
11547 #[doc = "Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."]
11548 #[serde(default, skip_serializing_if = "Option::is_none")]
11549 pub filter_filename: Option<String>,
11550 #[serde(default, skip_serializing_if = "Option::is_none")]
11551 pub filter_mailrule: Option<i64>,
11552 #[serde(default, skip_serializing_if = "Option::is_none")]
11553 pub matching_algorithm: Option<i64>,
11554 #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
11555 pub match_: Option<String>,
11556 #[serde(default, skip_serializing_if = "Option::is_none")]
11557 pub is_insensitive: Option<bool>,
11558 #[serde(default, skip_serializing_if = "Option::is_none")]
11559 pub filter_has_tags: Option<Vec<i64>>,
11560 #[serde(default, skip_serializing_if = "Option::is_none")]
11561 pub filter_has_correspondent: Option<i64>,
11562 #[serde(default, skip_serializing_if = "Option::is_none")]
11563 pub filter_has_document_type: Option<i64>,
11564 #[doc = "The number of days to offset the schedule trigger by."]
11565 #[serde(default, skip_serializing_if = "Option::is_none")]
11566 pub schedule_offset_days: Option<i64>,
11567 #[doc = "If the schedule should be recurring."]
11568 #[serde(default, skip_serializing_if = "Option::is_none")]
11569 pub schedule_is_recurring: Option<bool>,
11570 #[doc = "The number of days between recurring schedule triggers."]
11571 #[serde(default, skip_serializing_if = "Option::is_none")]
11572 pub schedule_recurring_interval_days: Option<i64>,
11573 #[doc = "The field to check for a schedule trigger.\n\n* `added` - Added\n* `created` - Created\n* `modified` - Modified\n* `custom_field` - Custom Field"]
11574 #[serde(default, skip_serializing_if = "Option::is_none")]
11575 pub schedule_date_field: Option<ScheduleDateFieldEnum>,
11576 #[serde(default, skip_serializing_if = "Option::is_none")]
11577 pub schedule_date_custom_field: Option<i64>,
11578}
11579
11580impl std::fmt::Display for WorkflowTriggerRequest {
11581 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11582 write!(
11583 f,
11584 "{}",
11585 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11586 )
11587 }
11588}
11589
11590#[cfg(feature = "tabled")]
11591impl tabled::Tabled for WorkflowTriggerRequest {
11592 const LENGTH: usize = 17;
11593 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11594 vec![
11595 if let Some(id) = &self.id {
11596 format!("{id:?}").into()
11597 } else {
11598 String::new().into()
11599 },
11600 format!("{:?}", self.sources).into(),
11601 format!("{:?}", self.type_).into(),
11602 if let Some(filter_path) = &self.filter_path {
11603 format!("{filter_path:?}").into()
11604 } else {
11605 String::new().into()
11606 },
11607 if let Some(filter_filename) = &self.filter_filename {
11608 format!("{filter_filename:?}").into()
11609 } else {
11610 String::new().into()
11611 },
11612 if let Some(filter_mailrule) = &self.filter_mailrule {
11613 format!("{filter_mailrule:?}").into()
11614 } else {
11615 String::new().into()
11616 },
11617 if let Some(matching_algorithm) = &self.matching_algorithm {
11618 format!("{matching_algorithm:?}").into()
11619 } else {
11620 String::new().into()
11621 },
11622 if let Some(match_) = &self.match_ {
11623 format!("{match_:?}").into()
11624 } else {
11625 String::new().into()
11626 },
11627 if let Some(is_insensitive) = &self.is_insensitive {
11628 format!("{is_insensitive:?}").into()
11629 } else {
11630 String::new().into()
11631 },
11632 if let Some(filter_has_tags) = &self.filter_has_tags {
11633 format!("{filter_has_tags:?}").into()
11634 } else {
11635 String::new().into()
11636 },
11637 if let Some(filter_has_correspondent) = &self.filter_has_correspondent {
11638 format!("{filter_has_correspondent:?}").into()
11639 } else {
11640 String::new().into()
11641 },
11642 if let Some(filter_has_document_type) = &self.filter_has_document_type {
11643 format!("{filter_has_document_type:?}").into()
11644 } else {
11645 String::new().into()
11646 },
11647 if let Some(schedule_offset_days) = &self.schedule_offset_days {
11648 format!("{schedule_offset_days:?}").into()
11649 } else {
11650 String::new().into()
11651 },
11652 if let Some(schedule_is_recurring) = &self.schedule_is_recurring {
11653 format!("{schedule_is_recurring:?}").into()
11654 } else {
11655 String::new().into()
11656 },
11657 if let Some(schedule_recurring_interval_days) = &self.schedule_recurring_interval_days {
11658 format!("{schedule_recurring_interval_days:?}").into()
11659 } else {
11660 String::new().into()
11661 },
11662 if let Some(schedule_date_field) = &self.schedule_date_field {
11663 format!("{schedule_date_field:?}").into()
11664 } else {
11665 String::new().into()
11666 },
11667 if let Some(schedule_date_custom_field) = &self.schedule_date_custom_field {
11668 format!("{schedule_date_custom_field:?}").into()
11669 } else {
11670 String::new().into()
11671 },
11672 ]
11673 }
11674
11675 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11676 vec![
11677 "id".into(),
11678 "sources".into(),
11679 "type_".into(),
11680 "filter_path".into(),
11681 "filter_filename".into(),
11682 "filter_mailrule".into(),
11683 "matching_algorithm".into(),
11684 "match_".into(),
11685 "is_insensitive".into(),
11686 "filter_has_tags".into(),
11687 "filter_has_correspondent".into(),
11688 "filter_has_document_type".into(),
11689 "schedule_offset_days".into(),
11690 "schedule_is_recurring".into(),
11691 "schedule_recurring_interval_days".into(),
11692 "schedule_date_field".into(),
11693 "schedule_date_custom_field".into(),
11694 ]
11695 }
11696}
11697
11698#[derive(
11699 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11700)]
11701#[allow(non_snake_case)]
11702pub struct DocumentShareLinksResponse {
11703 #[serde(default, skip_serializing_if = "Option::is_none")]
11704 pub id: Option<i64>,
11705 #[serde(default, skip_serializing_if = "Option::is_none")]
11706 pub created: Option<chrono::DateTime<chrono::Utc>>,
11707 #[serde(default, skip_serializing_if = "Option::is_none")]
11708 pub expiration: Option<chrono::DateTime<chrono::Utc>>,
11709 #[serde(default, skip_serializing_if = "Option::is_none")]
11710 pub slug: Option<String>,
11711}
11712
11713impl std::fmt::Display for DocumentShareLinksResponse {
11714 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11715 write!(
11716 f,
11717 "{}",
11718 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11719 )
11720 }
11721}
11722
11723#[cfg(feature = "tabled")]
11724impl tabled::Tabled for DocumentShareLinksResponse {
11725 const LENGTH: usize = 4;
11726 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11727 vec![
11728 if let Some(id) = &self.id {
11729 format!("{id:?}").into()
11730 } else {
11731 String::new().into()
11732 },
11733 if let Some(created) = &self.created {
11734 format!("{created:?}").into()
11735 } else {
11736 String::new().into()
11737 },
11738 if let Some(expiration) = &self.expiration {
11739 format!("{expiration:?}").into()
11740 } else {
11741 String::new().into()
11742 },
11743 if let Some(slug) = &self.slug {
11744 format!("{slug:?}").into()
11745 } else {
11746 String::new().into()
11747 },
11748 ]
11749 }
11750
11751 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11752 vec![
11753 "id".into(),
11754 "created".into(),
11755 "expiration".into(),
11756 "slug".into(),
11757 ]
11758 }
11759}
11760
11761#[derive(
11762 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11763)]
11764#[allow(non_snake_case)]
11765pub struct ProfileDisconnectSocialAccountCreateRequestBody {
11766 pub id: i64,
11767}
11768
11769impl std::fmt::Display for ProfileDisconnectSocialAccountCreateRequestBody {
11770 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11771 write!(
11772 f,
11773 "{}",
11774 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11775 )
11776 }
11777}
11778
11779#[cfg(feature = "tabled")]
11780impl tabled::Tabled for ProfileDisconnectSocialAccountCreateRequestBody {
11781 const LENGTH: usize = 1;
11782 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11783 vec![format!("{:?}", self.id).into()]
11784 }
11785
11786 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11787 vec!["id".into()]
11788 }
11789}
11790
11791#[derive(
11792 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11793)]
11794#[allow(non_snake_case)]
11795pub struct ProfileTotpCreateRequestBody {
11796 pub secret: String,
11797 pub code: String,
11798}
11799
11800impl std::fmt::Display for ProfileTotpCreateRequestBody {
11801 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11802 write!(
11803 f,
11804 "{}",
11805 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11806 )
11807 }
11808}
11809
11810#[cfg(feature = "tabled")]
11811impl tabled::Tabled for ProfileTotpCreateRequestBody {
11812 const LENGTH: usize = 2;
11813 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11814 vec![self.secret.clone().into(), self.code.clone().into()]
11815 }
11816
11817 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11818 vec!["secret".into(), "code".into()]
11819 }
11820}
11821
11822#[derive(
11823 serde :: Serialize,
11824 serde :: Deserialize,
11825 PartialEq,
11826 Hash,
11827 Debug,
11828 Clone,
11829 schemars :: JsonSchema,
11830 parse_display :: FromStr,
11831 parse_display :: Display,
11832)]
11833#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
11834#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
11835pub enum Status {
11836 #[serde(rename = "FAILURE")]
11837 #[display("FAILURE")]
11838 Failure,
11839 #[serde(rename = "PENDING")]
11840 #[display("PENDING")]
11841 Pending,
11842 #[serde(rename = "RECEIVED")]
11843 #[display("RECEIVED")]
11844 Received,
11845 #[serde(rename = "RETRY")]
11846 #[display("RETRY")]
11847 Retry,
11848 #[serde(rename = "REVOKED")]
11849 #[display("REVOKED")]
11850 Revoked,
11851 #[serde(rename = "STARTED")]
11852 #[display("STARTED")]
11853 Started,
11854 #[serde(rename = "SUCCESS")]
11855 #[display("SUCCESS")]
11856 Success,
11857}
11858
11859#[derive(
11860 serde :: Serialize,
11861 serde :: Deserialize,
11862 PartialEq,
11863 Hash,
11864 Debug,
11865 Clone,
11866 schemars :: JsonSchema,
11867 parse_display :: FromStr,
11868 parse_display :: Display,
11869)]
11870#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
11871#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
11872pub enum ListTaskName {
11873 #[serde(rename = "check_sanity")]
11874 #[display("check_sanity")]
11875 CheckSanity,
11876 #[serde(rename = "consume_file")]
11877 #[display("consume_file")]
11878 ConsumeFile,
11879 #[serde(rename = "index_optimize")]
11880 #[display("index_optimize")]
11881 IndexOptimize,
11882 #[serde(rename = "train_classifier")]
11883 #[display("train_classifier")]
11884 TrainClassifier,
11885}
11886
11887#[derive(
11888 serde :: Serialize,
11889 serde :: Deserialize,
11890 PartialEq,
11891 Hash,
11892 Debug,
11893 Clone,
11894 schemars :: JsonSchema,
11895 parse_display :: FromStr,
11896 parse_display :: Display,
11897)]
11898#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
11899#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
11900pub enum Type {
11901 #[serde(rename = "auto_task")]
11902 #[display("auto_task")]
11903 AutoTask,
11904 #[serde(rename = "manual_task")]
11905 #[display("manual_task")]
11906 ManualTask,
11907 #[serde(rename = "scheduled_task")]
11908 #[display("scheduled_task")]
11909 ScheduledTask,
11910}
11911
11912#[derive(
11913 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
11914)]
11915#[allow(non_snake_case)]
11916pub struct AcknowledgeTasksRequestBody {
11917 pub tasks: Vec<i64>,
11918}
11919
11920impl std::fmt::Display for AcknowledgeTasksRequestBody {
11921 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
11922 write!(
11923 f,
11924 "{}",
11925 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
11926 )
11927 }
11928}
11929
11930#[cfg(feature = "tabled")]
11931impl tabled::Tabled for AcknowledgeTasksRequestBody {
11932 const LENGTH: usize = 1;
11933 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
11934 vec![format!("{:?}", self.tasks).into()]
11935 }
11936
11937 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
11938 vec!["tasks".into()]
11939 }
11940}