hrobot/
lib.rs

1//! `hrobot` is an unofficial asynchronous Rust client for interacting with the [Hetzner Robot API](https://robot.your-server.de/doc/webservice/en.html)
2//!
3//! See the [`AsyncRobot`] struct for a complete list of supported API Endpoints.
4//!
5//! **Disclaimer:** the authors are not associated with Hetzner (except as customers), and the crate is in no way endorsed or supported by Hetzner Online GmbH.
6//!
7//! # Requirements for usage
8//! A Hetzner WebService/app user is required to make use of this library.
9//!
10//! If you already have a Hetzner account, you can create one through the [Hetzner Robot](https://robot.your-server.de) web interface under [Settings/Preferences](https://robot.your-server.de/preferences/index).
11//!
12//! # Example
13//! Here's a quick example showing how to instantiate the [`AsyncRobot`] client object
14//! and fetching a list of all dedicated servers owned by the account identified by `username`
15//! ```rust,no_run
16//! use hrobot::*;
17//!
18//! #[tokio::main]
19//! async fn main() {
20//!     // Robot is instantiated using the environment
21//!     // variables HROBOT_USERNAME an HROBOT_PASSWORD.
22//!     let robot = AsyncRobot::default();
23//!
24//!     for server in robot.list_servers().await.unwrap() {
25//!         println!("{name}: {product} in {location}",
26//!             name = server.name,
27//!             product = server.product,
28//!             location = server.dc
29//!         );
30//!     }
31//! }
32//! ```
33//!
34//! Running the above example should yield something similar to the output below:
35//! ```text
36//! foo: AX51-NVMe in FSN1-DC18
37//! bar: Server Auction in FSN1-DC5
38//! ```
39#![deny(
40    bad_style,
41    dead_code,
42    improper_ctypes,
43    non_shorthand_field_patterns,
44    no_mangle_generic_items,
45    overflowing_literals,
46    path_statements,
47    patterns_in_fns_without_body,
48    unconditional_recursion,
49    unused,
50    unused_allocation,
51    unused_comparisons,
52    unused_parens,
53    while_true,
54    missing_debug_implementations,
55    missing_docs,
56    trivial_casts,
57    trivial_numeric_casts,
58    unused_extern_crates,
59    unused_import_braces,
60    unused_qualifications,
61    unused_results
62)]
63#![forbid(unsafe_code)]
64pub mod api;
65pub mod error;
66
67mod client;
68mod conversion;
69mod urlencode;
70
71pub use ::bytesize;
72pub use ::rust_decimal;
73pub use ::time;
74pub use client::*;