1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//! The official Rust client for the [Invoist API](https://invoi.st/docs):
//! turn invoices into structured data, read a household's bills, and verify
//! the webhooks Invoist sends.
//!
//! # A business workspace
//!
//! ```no_run
//! # async fn run() -> Result<(), invoist::Error> {
//! use invoist::{Client, UploadFile, WaitOptions};
//!
//! let client = Client::from_env()?; // INVOIST_API_KEY
//! let file = UploadFile::from_path_async("invoice.pdf").await.expect("readable file");
//! let done = client.extract_and_wait(file, WaitOptions::default()).await?;
//! println!("{:?} owes {:?} cents", done.extraction.vendor_name, done.extraction.total_cents);
//! # Ok(())
//! # }
//! ```
//!
//! # A household
//!
//! ```no_run
//! # async fn run() -> Result<(), invoist::Error> {
//! use invoist::{Client, ListBillsParams};
//!
//! let client = Client::from_env()?;
//! let unpaid = client
//! .bills()
//! .list(ListBillsParams { paid: Some(false), ..Default::default() })
//! .await?;
//! for bill in unpaid {
//! println!("{:?}: {:?} due {:?}", bill.vendor_name, bill.total_cents, bill.due_date);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! # Errors, retries, cancellation
//!
//! Every failure is an [`Error`] with an HTTP [`status`](Error::status) (0 when
//! no response arrived), a stable [`code`](Error::code), and the response's
//! [`request_id`](Error::request_id). Failures worth retrying (no response,
//! 429, 5xx) are retried up to twice, honouring `Retry-After` (a wait above
//! 60 seconds fails at once instead), otherwise
//! backing off from 500ms with jitter. Dropping a call's future cancels it.
//!
//! # Features
//!
//! * `rustls-tls` (default): TLS through rustls. No OpenSSL.
//! * `native-tls`: TLS through the platform's library instead.
//! * `http2`: HTTP/2 when the server offers it.
//! * `blocking`: [`blocking::Client`], for code without an async runtime.
//!
//! Money is always an `i64` in minor units (cents), never a float.
pub use string_enum;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Month;
pub use ;
/// The `bytes` crate, whose `Bytes` holds uploads and downloads.
pub use bytes;
/// The `reqwest` crate this client is built on, to build a custom
/// [`reqwest::Client`] for [`ClientBuilder::http_client`] with the same
/// version.
pub use reqwest;
/// The `User-Agent` every request sends.
pub const USER_AGENT: &str = USER_AGENT;
;