1 stable release
1.0.0 | Dec 4, 2024 |
---|
#1189 in Command line utilities
161 downloads per month
29KB
155 lines
Intrac
This is an unofficial tiny API client for Easypack24 v1 (InPost delivery services) that helps you track locker-to-locker deliveries of parcels on the aforementioned platforms.
The API endpoints used are public and don't require authentication at the time of writing. The full API docs are available at InPost Italy Developers.
As a library
You can use this crate as a library in your projects. It provides a fully async API and complete type definitions with doc comments.
Library Example
use intrac::InPostApiClient;
pub async fn print_shipment_status(shipment_id: &str /* 0123...888 */) -> Result<(), Box<dyn std::error::Error>> {
let mut api_client = InPostApiClient::new("it" /* country code */)?;
let shipment = api_client.lookup_shipment(shipment_id).await?;
println!("Status: {}", shipment.status);
// And many more fields, as found in the Shipment struct.
Ok(())
}
As a command-line tool
You can also use this as a standalone application, to track your shipments.
Simply invoke the executable (cargo build
) or run it from the repo (cargo run --
) with the
shipment IDs as arguments. You must provide at least one ID, and they will be resolved in order.
CLI Example
# Query two shipments
./intrac 843534321829832368922940 863723273223883882932840
# Will output the following (truncated for brevity):
Shipment 843534321829832368922940
Created at: 2024-12-02 14:10:03.098 UTC
Updated at: 2024-12-03 15:03:32.077 UTC
Type: inpost_locker_standard
Service: inpost_locker_standard
Status: sent_from_sorting_center
Size: C
End-of-week collection: no
Drop-off machine:
Name: ITTOR11684
Machine type: ParcelLocker
Address: C.so Filippo Turati 75, 10134 Torino
Location: N45.04681, E7.66353 (presso CARREFOUR)
24/7: yes
Opening hours: 24/7
Target machine:
Name: ITVAR44848M
Machine type: ParcelLocker
Address: Via Giovanni Borghi 30/0, 21100 Varese
Location: N45.83419, E8.79707 (Lidl)
24/7: yes
Event log:
Date & time: 2024-12-03 15:03:32 UTC
Status: adopted_at_source_branch
Origin status: PWO
----------
Date & time: 2024-12-03 14:38:26 UTC
Status: taken_by_courier
Origin status: CustomerSent
Agency: MI2
----------
Date & time: 2024-12-03 11:07:48 UTC
Status: dispatched_by_sender
Origin status: CustomerStored
Agency: MI2
----------
Date & time: 2024-12-02 14:10:03 UTC
Status: confirmed
Origin status: CustomerDelivering
Agency: MI2
----------
Shipment 863723273223883882932840
Created at: [...]
Not implemented yet
- Authenticated requests: label creation, shipment creation, query by company
- Points list
expected_flow
inShipment
location
inTrackingEvent
Dependencies
~8–19MB
~261K SLoC