mirror of https://github.com/MedzikUser/imgurs
documentation: add in lib.rs
This commit is contained in:
parent
08c25212ae
commit
d98208f677
|
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
### Added
|
||||
- commands in the code
|
||||
- api functions to `impl` in `ImgurClient`
|
||||
- documentation (example usage)
|
||||
|
||||
### Breaking Changes
|
||||
- lib: moved everything to the main package with api submodules (before `imgurs::api::ImgurClient`, after `imgurs::api::ImgurClient`)
|
||||
|
|
53
src/lib.rs
53
src/lib.rs
|
@ -1,3 +1,56 @@
|
|||
//! This crate is an unofficial implementation of the [Imgur](https://imgur.com) API in Rust.
|
||||
//!
|
||||
//! # 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]
|
||||
//! imgurs = "0.7.0"
|
||||
//! ```
|
||||
//!
|
||||
//! # Example Usage
|
||||
//!
|
||||
//! ## Create new ImgurClient
|
||||
//! ```
|
||||
//! use imgurs::ImgurClient;
|
||||
//!
|
||||
//! let client = ImgurClient::new("client id");
|
||||
//! ```
|
||||
//!
|
||||
//! ## Image Upload
|
||||
//! ```
|
||||
//! // From URL
|
||||
//! let info = client.upload_image("https://cdn.magicuser.cf/lFaGr1x.png").await?
|
||||
//!
|
||||
//! // From File
|
||||
//! let info = client.upload_image("path/to/image.png").await?
|
||||
//! ```
|
||||
//!
|
||||
//! ## Delete Image
|
||||
//! ```
|
||||
//! client.delete_image("SuPeRsEcReTDeLeTeHaSh").await? // delete hash
|
||||
//! ```
|
||||
//!
|
||||
//! ## Get Image Info
|
||||
//! ```
|
||||
//! let info = client.image_info("lFaGr1x").await? // image id
|
||||
//!
|
||||
//! println!("{:?}", info)
|
||||
//! ```
|
||||
//!
|
||||
//! ## Get Client RateLimit
|
||||
//! ```
|
||||
//! let info = client.rate_limit.await?
|
||||
//!
|
||||
//! println!("{:?}", info)
|
||||
//! ```
|
||||
|
||||
mod api;
|
||||
|
||||
pub use api::*;
|
||||
|
|
Loading…
Reference in New Issue