32 lines
841 B
Markdown
32 lines
841 B
Markdown
|
# libpaket
|
|||
|
|
|||
|
This is an unofficial client to various DHL APIs, more specific the ones that the proprietary app `Post & DHL` uses.
|
|||
|
|
|||
|
## Features
|
|||
|
|
|||
|
- Mail Notification (Briefankündigung)
|
|||
|
|
|||
|
## Goals
|
|||
|
|
|||
|
- app-driven parcel lockers (App-gesteuerte Packstation)
|
|||
|
|
|||
|
## Examples
|
|||
|
|
|||
|
In the examples error-handling is ignored for simplicity. You don’t want to do that.
|
|||
|
|
|||
|
### Getting mail notifications (Briefankündigung)
|
|||
|
```rust
|
|||
|
// Requires a logged-in user.
|
|||
|
let token: libpaket::login::DHLIdToken;
|
|||
|
|
|||
|
let response = libpaket::WebClient::new().advices(&token).await.unwrap();
|
|||
|
|
|||
|
let client = libpaket::AdviceClient::new();
|
|||
|
|
|||
|
if let Some(current_advice) = response.get_current_advice() {
|
|||
|
let advices_token = client.access_token(&response),unwrap();
|
|||
|
let bin: Vec<u8> = client.fetch_advice_image(¤t_advice.list[0], advice_token).await.unwrap();
|
|||
|
}
|
|||
|
```
|
|||
|
|