From 99bb02f10c889f54b288ab63d85f55c3a2426631 Mon Sep 17 00:00:00 2001 From: Radical Date: Tue, 20 May 2025 01:50:22 +0200 Subject: [PATCH 1/2] docs: fix up docs related to getting started, etc. --- src/edge_storage.rs | 6 +++++- src/lib.rs | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/edge_storage.rs b/src/edge_storage.rs index b11514a..7b6d9bc 100644 --- a/src/edge_storage.rs +++ b/src/edge_storage.rs @@ -101,9 +101,11 @@ impl<'a> Storage { /// /// #[tokio::main] /// async fn main() -> Result<(), Error> { - /// let mut client = Client::new("api_key")?; + /// let mut client = Client::new("api_key").await?; /// /// client.storage.init(Endpoint::Frankfurt, "MyStorageZone"); + /// + /// Ok(()) /// } /// ``` pub fn init>(&mut self, endpoint: Endpoint, storage_zone: T) -> Result<(), Error> { @@ -130,6 +132,8 @@ impl<'a> Storage { /// /// // Will put a file in STORAGE_ZONE/images/file.png /// client.storage.upload("/images/file.png", file_bytes).await?; + /// + /// Ok(()) /// } /// ``` pub async fn upload>(&self, path: T, file: Bytes) -> Result<(), Error> { diff --git a/src/lib.rs b/src/lib.rs index 38e89f7..d6f6708 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,22 @@ //! This library provides access to the Bunny API asynchronously using tokio, it's not fully implemented but PRs are welcome. +//! +//! # Getting started +//! 1. add package to your project using cargo +//! +//! `$ cargo add bunny-api-tokio` +//! +//! 2. Start coding +//! +//! ``` +//! use bunny_api_tokio::{Client, error::Error}; +//! +//! #[tokio::main] +//! async fn main() -> Result<(), Error> { +//! let mut client = Client::new("api_key").await?; +//! +//! Ok(()) +//! } +//! ``` #![deny(missing_docs)] use std::sync::Arc; @@ -23,7 +41,9 @@ impl Client { /// /// #[tokio::main] /// async fn main() -> Result<(), Error> { - /// let mut client = Client::new("api_key")?; + /// let mut client = Client::new("api_key").await?; + /// + /// Ok(()) /// } /// ``` pub async fn new>(api_key: T) -> Result { From 0c88ac87d91887d8eee4bc7c57882922cd522f8e Mon Sep 17 00:00:00 2001 From: Radical Date: Tue, 20 May 2025 01:51:15 +0200 Subject: [PATCH 2/2] feat: add repo and description to Cargo.toml --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index ae0745e..d31cf20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,8 @@ version = "0.1.0" edition = "2024" authors = ["Radical "] license = "MIT" +repository = "https://git.gorb.app/gorb/bunny-api-tokio" +description = "Provides access to the Bunny CDN API asynchronously using tokio." [dependencies]