use serde::{Deserialize, Serialize};
use serde_aux::field_attributes::deserialize_number_from_string;
#[derive(Serialize)]
pub struct RequestParameters {
#[serde(rename = "OF")]
pub of: u8,
#[serde(rename = "NAM")]
pub nam: Option<String>,
#[serde(rename = "NUM")]
pub num: Option<String>,
#[serde(rename = "TN")]
pub tn: Option<String>,
#[serde(rename = "OC")]
pub oc: Option<String>,
#[serde(rename = "DS")]
pub ds: Option<String>,
#[serde(rename = "DE")]
pub de: Option<String>,
#[serde(rename = "AFP")]
pub afp: Option<u8>,
#[serde(rename = "BS")]
pub bs: Option<u8>,
#[serde(rename = "REC")]
pub rec: Option<String>,
#[serde(rename = "TEC")]
pub tec: Option<String>,
#[serde(rename = "MC")]
pub mc: u8,
}
impl RequestParameters {
pub fn new() -> RequestParameters {
RequestParameters {
of: 2,
nam: None,
num: None,
tn: None,
oc: None,
ds: None,
de: None,
afp: None,
bs: None,
rec: None,
tec: None,
mc: 1,
}
}
pub fn set_nam<S: Into<String>>(&mut self, nam: S) {
self.nam = Option::from(nam.into());
}
pub fn set_num<S: Into<String>>(&mut self, num: S) {
self.num = Option::from(num.into());
}
pub fn set_tn<S: Into<String>>(&mut self, tn: S) {
self.tn = Option::from(tn.into());
}
pub fn set_oc<S: Into<String>>(&mut self, oc: S) {
self.oc = Option::from(oc.into());
}
pub fn set_ds<S: Into<String>>(&mut self, ds: S) {
self.ds = Option::from(ds.into());
}
pub fn set_de<S: Into<String>>(&mut self, de: S) {
self.de = Option::from(de.into());
}
pub fn set_afp<T: Into<u8>>(&mut self, afp: T) {
self.afp = Option::from(afp.into());
}
pub fn set_bs<T: Into<u8>>(&mut self, bs: T) {
self.bs = Option::from(bs.into());
}
pub fn set_rec<S: Into<String>>(&mut self, rec: S) {
self.rec = Option::from(rec.into());
}
pub fn set_tec<S: Into<String>>(&mut self, tec: S) {
self.tec = Option::from(tec.into());
}
}
#[derive(Deserialize)]
pub struct Response {
#[serde(rename = "gitekiInformation")]
pub giteki_information: GitekiInformation,
#[serde(rename = "giteki")]
pub giteki: Giteki,
}
#[derive(Deserialize)]
pub struct GitekiInformation {
#[serde(rename = "lastUpdateDate")]
pub last_update_date: String,
#[serde(
rename = "totalCount",
deserialize_with = "deserialize_number_from_string"
)]
pub total_count: usize,
}
#[derive(Deserialize)]
pub struct Giteki {
#[serde(deserialize_with = "deserialize_number_from_string")]
pub count: usize,
}