gyazo_api/
lib.rs

1#![warn(missing_docs)]
2#![warn(rustdoc::missing_crate_level_docs)]
3
4//! # Gyazo API
5//!
6//! This crate provides a client for interacting with the Gyazo API.
7//! It includes modules for uploading, fetching, and deleting images.
8//!
9//! ## Example
10//!
11//! ```rust
12//! use gyazo_api::{upload::GyazoUploadOptions, Gyazo};
13//!
14//! let gyazo = Gyazo::new("your_access_token".to_string());
15//! let options = GyazoUploadOptions {
16//!     title: Some("My Image Title".to_string()),
17//!     ..Default::default()
18//! };
19//! let result = gyazo.upload("image.jpg", Some(&options)).await;
20//! ```
21
22/// Handles image deletion via the Gyazo API.
23pub mod delete;
24
25/// Handles fetching images and metadata via the Gyazo API.
26pub mod get;
27
28/// Handles uploading images via the Gyazo API.
29pub mod upload;
30
31// pub mod onEmbed;
32
33mod access_policy;
34
35use reqwest::Client;
36
37/// A client for interacting with the Gyazo API.
38pub struct Gyazo {
39    /// Access token for authentication.
40    pub access_token: String,
41    /// HTTP client for making requests.
42    pub client: Client,
43}
44
45impl Gyazo {
46    /// Creates a new instance of the Gyazo client.
47    ///
48    /// # Arguments
49    ///
50    /// * `access_token` - A `String` representing the access token.
51    ///
52    /// # Example
53    ///
54    /// ```
55    /// let gyazo = Gyazo::new("your_access_token".to_string());
56    /// ```
57    pub fn new(access_token: String) -> Self {
58        Gyazo {
59            access_token,
60            client: Client::new(),
61        }
62    }
63}