jane400
1b3b773f80
Features: - meson - (almost) all strings are localized - relm4_icons no longer used - default.nix updated but not tested - updated dependencies - unused for now: paket-utils, paket/locker - build-aux/checks.sh now enforced - fixups in libpaket/tracking parsing - libpaket: RegTokenDecodeError instead of generic DecodeError - moving dependency versions to workspace Cargo.toml - default.nix adjusted - README.md added - dependency: relm4 version pinned to include fixes
39 lines
1.7 KiB
Markdown
39 lines
1.7 KiB
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)
|
||
|
||
## Deprecation notice
|
||
|
||
It's recommended that consumers of this crate are always tracking the latest version. If the upstream API changes too much or a better API here is created, there are two ways to mark a function or struct deprecated:
|
||
|
||
- Soft deprecation/Crate API changes: The normal deprecation notice via `#[deprecated]` (see the [RFC#1270](https://github.com/rust-lang/rfcs/blob/master/text/1270-deprecation.md) or the [rust reference docs](https://doc.rust-lang.org/reference/attributes/diagnostics.html)).
|
||
- (Fatal) Upstream API Changes: The soft deprecation marked with `deny(deprecated)`, you can try to override this, but functions with a `LibraryResult` will always return `LibraryError::Deprecated`. (NOTE: `LibrarayError::APIChange` is reserved for the case where the API-change is unknown. Please upgrade to a or wait for a newer crate version.)
|
||
|
||
## 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();
|
||
}
|
||
```
|
||
|