Skip to main content

fiocz_rs/types/
mod.rs

1//! This module contains all the types used in the application.
2pub mod account_statement;
3pub mod import_response;
4pub mod merchant;
5pub mod transaction;
6
7use std::fmt;
8
9/// Supported export data formats
10///
11/// The FIO API supports multiple data formats for downloading movements
12/// and statements. Not all formats are available for all endpoints.
13#[derive(Debug, Clone, Copy, Eq, PartialEq)]
14pub enum ExportFormat {
15    /// JSON format
16    Json,
17    /// XML (Fio proprietary) format
18    Xml,
19    /// CSV format (semicolon-separated, UTF-8)
20    Csv,
21    /// GPC format (fixed-width, Windows-1250)
22    Gpc,
23    /// HTML format
24    Html,
25    /// OFX format
26    Ofx,
27    /// PDF format (statements only)
28    Pdf,
29    /// MT940 / STA format (statements only)
30    Mt940,
31    /// CBA XML / CAMT.053 Czech national format (statements only)
32    CbaXml,
33    /// SBA XML / CAMT.053 Slovak national format (statements only)
34    SbaXml,
35}
36
37impl fmt::Display for ExportFormat {
38    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39        match self {
40            Self::Json => write!(f, "json"),
41            Self::Xml => write!(f, "xml"),
42            Self::Csv => write!(f, "csv"),
43            Self::Gpc => write!(f, "gpc"),
44            Self::Html => write!(f, "html"),
45            Self::Ofx => write!(f, "ofx"),
46            Self::Pdf => write!(f, "pdf"),
47            Self::Mt940 => write!(f, "sta"),
48            Self::CbaXml => write!(f, "cba_xml"),
49            Self::SbaXml => write!(f, "sba_xml"),
50        }
51    }
52}