2022-05-18 17:48:39 +00:00
|
|
|
//! This crate is an unofficial implementation of the [Imgur API](https://imgur.com) in Rust.
|
2022-04-03 19:32:42 +00:00
|
|
|
//!
|
|
|
|
//! # Installation
|
|
|
|
//!
|
|
|
|
//! ## Requirements
|
|
|
|
//! - Rust 1.58 (earlier versions are not tested (only the latest stable version is tested!))
|
|
|
|
//! - Network connection
|
|
|
|
//!
|
|
|
|
//! ## Importing
|
|
|
|
//! The driver is available on [crates.io](https://crates.io/crates/imgurs). To use the driver in
|
|
|
|
//! your application, simply add it to your project's `Cargo.toml`.
|
|
|
|
//! ```toml
|
|
|
|
//! [dependencies]
|
2022-04-04 17:04:49 +00:00
|
|
|
//! imgurs = "0.7.1"
|
2022-04-03 19:32:42 +00:00
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! # Example Usage
|
|
|
|
//!
|
|
|
|
//! ## Create new ImgurClient
|
2022-05-18 17:48:39 +00:00
|
|
|
//! ```ignore
|
2022-04-03 19:32:42 +00:00
|
|
|
//! use imgurs::ImgurClient;
|
|
|
|
//!
|
|
|
|
//! let client = ImgurClient::new("client id");
|
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! ## Image Upload
|
2022-05-18 17:48:39 +00:00
|
|
|
//! ```ignore
|
2022-04-03 19:32:42 +00:00
|
|
|
//! // From URL
|
2022-05-18 17:48:39 +00:00
|
|
|
//! let info = client.upload_image("https://i.imgur.com/lFaGr1x.png").await?;
|
2022-04-03 19:32:42 +00:00
|
|
|
//!
|
|
|
|
//! // From File
|
2022-04-04 17:08:33 +00:00
|
|
|
//! let info = client.upload_image("path/to/image.png").await?;
|
2022-04-03 19:32:42 +00:00
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! ## Delete Image
|
2022-05-18 17:48:39 +00:00
|
|
|
//! ```ignore
|
2022-04-04 17:08:33 +00:00
|
|
|
//! client.delete_image("SuPeRsEcReTDeLeTeHaSh").await?; // delete hash
|
2022-04-03 19:32:42 +00:00
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! ## Get Image Info
|
2022-05-18 17:48:39 +00:00
|
|
|
//! ```ignore
|
2022-04-04 17:08:33 +00:00
|
|
|
//! let info = client.image_info("lFaGr1x").await?; // image id
|
2022-04-03 19:32:42 +00:00
|
|
|
//!
|
2022-04-04 17:08:33 +00:00
|
|
|
//! println!("{:?}", info);
|
2022-04-03 19:32:42 +00:00
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! ## Get Client RateLimit
|
2022-05-18 17:48:39 +00:00
|
|
|
//! ```ignore
|
2022-04-04 17:08:33 +00:00
|
|
|
//! let info = client.rate_limit.await?;
|
2022-04-03 19:32:42 +00:00
|
|
|
//!
|
2022-04-04 17:08:33 +00:00
|
|
|
//! println!("{:?}", info);
|
2022-04-03 19:32:42 +00:00
|
|
|
//! ```
|
|
|
|
|
2022-04-03 19:01:58 +00:00
|
|
|
mod api;
|
|
|
|
|
|
|
|
pub use api::*;
|