alpr/lib.rs
1// Code generated by sdk/generator. DO NOT EDIT.
2
3//! Alpr.sh's SDK for Rust, generated from Alpr.sh's API contract.
4//!
5//! A [`Client`] calls the API with one workspace's API key
6//! (`alpr_live_…`). A refusal is [`Error::Api`].
7//!
8//! ```no_run
9//! use alpr::{Client, PhotosRecognizeParams, RecognitionsListParams};
10//!
11//! # fn main() -> Result<(), alpr::Error> {
12//! let client = Client::new("alpr_live_…");
13//!
14//! let photo = std::fs::read("carro.jpg").unwrap();
15//! let result = client.photos().recognize(&PhotosRecognizeParams::new(photo))?;
16//! for plate in &result.plates {
17//! println!("{} ({})", plate.plate, plate.conf);
18//! }
19//!
20//! for reading in client.recognitions().list_iter(RecognitionsListParams::new()) {
21//! println!("{}", reading?.plate);
22//! }
23//! # Ok(())
24//! # }
25//! ```
26//!
27//! Webhooks are checked with [`verify_webhook`] before their body is read.
28
29#![forbid(unsafe_code)]
30#![warn(missing_docs)]
31
32mod client;
33mod error;
34mod multipart;
35// The models, services and webhooks are written by the generator, which lays
36// them out itself.
37#[rustfmt::skip]
38pub mod models;
39mod pagination;
40#[rustfmt::skip]
41mod services;
42mod version;
43#[rustfmt::skip]
44mod webhooks;
45
46pub use client::{
47 BoxError, Client, ClientBuilder, HttpRequest, HttpResponse, RequestOptions, Transport,
48 UreqTransport,
49};
50pub use error::{ApiError, Error};
51pub use models::*;
52pub use pagination::Page;
53pub use services::*;
54pub use version::{API_VERSION, DEFAULT_BASE_URL, VERSION};
55pub use webhooks::{
56 verify_webhook, verify_webhook_at, verify_webhook_signature, verify_webhook_signature_at,
57 UnknownWebhookEvent, WebhookError, WebhookEvent, WEBHOOK_TOLERANCE,
58};
59
60// The event of each kind of data a webhook carries.
61pub use webhooks::AlertTriggeredWebhookEvent;
62pub use webhooks::RecognitionCreatedWebhookEvent;
63pub use webhooks::TestWebhookEvent;