The Rust interface to online accounting service Fakturoid.
This library is developed and maintained by Josef Rokos (pepa@bukova.info). It is unoficial and no support from Fakturoid team can be claimed.
This library is asynchronous, so you will need Tokio to execute library methods.
Cargo.toml
could look like this:
toml
[dependencies]
fakturoid = "0.1.0"
tokio = {version = "0.2", features = ["full"]}
```rust
async fn main() -> Result<(), Box
let subject = cli.detail::<Subject>(11223344).await?;
println!("{:?}", subject);
Ok(())
} ```
All fields of model structs has type Option<...>
. If some field will have None
value this field will not be serialized,
so you can create new struct of given type and set only fields which you want update:
```rust
async fn main() -> Result<(), Box
let mut subject = Subject::default(); // initialize all fields to None
subject.name = Some("Some other name".to_string());
let subject = cli.update(11223344, subject).await?;
println!("{:?}", subject);
Ok(())
} ```
Updated object will be returned in case of success. You can create new objects in similar way:
rust
let mut subject = Subject::default(); // initialize all fields to None
subject.name = Some("Some other name".to_string());
let subject = cli.create(subject).await?;
Fakturoid.cz API returns all lists with more than 20 items in form pages of 20 items. This is represented by PagedResponse
struct. Pages can be accessed through methods of this struct:
rust
let invoices = cli.list::<Invoice>(None).await?;
println!("{:?}", invoices.data()[0]);
let invoices = invoices.next_page().await?;