1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! # urlshortener
//!
//! An easy library for retrieving short urls.
//!
//! ## Usage
//!
//! Creating a short URL via a specified provider is very simple:
//!
//! ```rust,no_run
//! # #[cfg(not(feature = "client"))]
//! # fn main() {}
//! # #[cfg(feature = "client")]
//! # fn main() {
//! use urlshortener::{providers::Provider, client::UrlShortener};
//!
//! let us = UrlShortener::new().unwrap();
//! let short_url = us.generate("https://my-long-url.com", &Provider::IsGd);
//! assert!(short_url.is_ok());
//! # }
//! ```
//!
//! Or attempting all URL shorteners until one is successfully generated:
//!
//! ```rust,no_run
//! # #[cfg(not(feature = "client"))]
//! # fn main() {}
//! # #[cfg(feature = "client")]
//! # fn main() {
//! use urlshortener::client::UrlShortener;
//!
//! let us = UrlShortener::new().unwrap();
//! let short_url = us.try_generate("https://my-long-url.com", None);
//! assert!(short_url.is_ok());
//! # }
//! ```
//! In order to use service with authentication use the appropriate provider directly:
//!
//! ```rust,no_run
//! # #[cfg(not(feature = "client"))]
//! # fn main() {}
//! # #[cfg(feature = "client")]
//! # fn main() {
//! use urlshortener::{ client::UrlShortener, providers::Provider };
//!
//! let us = UrlShortener::new().unwrap();
//! let key = "MY_API_KEY";
//! let short_url = us.generate("https://my-long-url.com", &Provider::GooGl { api_key:
//! key.to_owned() });
//! assert!(short_url.is_ok());
//! # }
//! ```
/// A urlshortener http client for performing requests.
/// A request builders for sending via http client.
/// A prelude module with main useful stuff.