invoice_export/
invoice_export.rs1use chrono::offset::Utc;
2
3#[tokio::main]
4async fn main() {
5
6 let client = ksef_client::KsefClient::new("https://api.ksef.mf.gov.pl".to_string(), 2000).unwrap();
7 let access_token = "<access_token>".to_string();
8
9 let invoice_query_filters = ksef_client::invoice::InvoiceQueryFilters {
10 subject_type: ksef_client::invoice::InvoiceSubjectType::Subject1,
11 date_range: ksef_client::invoice::DateRange {
12 from: Utc::now() - chrono::Duration::days(90),
13 to: Some(Utc::now()),
14 date_type: ksef_client::invoice::DateType::PermanentStorage,
15 restrict_to_permanent_storage_hwm_date: Some(true),
16 },
17 };
18
19 let get_invoice_export_result = match client.get_invoice_export(&invoice_query_filters, &access_token).await {
20 Ok(get_invoice_export_result) => get_invoice_export_result,
21 Err(e) => {
22 eprintln!("Error: {}; {}", e.code, e.message);
23 return;
24 }
25 };
26
27 println!("{:#?}", get_invoice_export_result);
28}