Compare commits
No commits in common. "0c88ac87d91887d8eee4bc7c57882922cd522f8e" and "49605fb85498f6f3a2b517c9fa62172e0b0c4b2a" have entirely different histories.
0c88ac87d9
...
49605fb854
3 changed files with 2 additions and 28 deletions
|
@ -4,8 +4,6 @@ version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ["Radical <radical@radical.fun>"]
|
authors = ["Radical <radical@radical.fun>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://git.gorb.app/gorb/bunny-api-tokio"
|
|
||||||
description = "Provides access to the Bunny CDN API asynchronously using tokio."
|
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -101,11 +101,9 @@ impl<'a> Storage {
|
||||||
///
|
///
|
||||||
/// #[tokio::main]
|
/// #[tokio::main]
|
||||||
/// async fn main() -> Result<(), Error> {
|
/// async fn main() -> Result<(), Error> {
|
||||||
/// let mut client = Client::new("api_key").await?;
|
/// let mut client = Client::new("api_key")?;
|
||||||
///
|
///
|
||||||
/// client.storage.init(Endpoint::Frankfurt, "MyStorageZone");
|
/// client.storage.init(Endpoint::Frankfurt, "MyStorageZone");
|
||||||
///
|
|
||||||
/// Ok(())
|
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn init<T: AsRef<str>>(&mut self, endpoint: Endpoint, storage_zone: T) -> Result<(), Error> {
|
pub fn init<T: AsRef<str>>(&mut self, endpoint: Endpoint, storage_zone: T) -> Result<(), Error> {
|
||||||
|
@ -132,8 +130,6 @@ impl<'a> Storage {
|
||||||
///
|
///
|
||||||
/// // Will put a file in STORAGE_ZONE/images/file.png
|
/// // Will put a file in STORAGE_ZONE/images/file.png
|
||||||
/// client.storage.upload("/images/file.png", file_bytes).await?;
|
/// client.storage.upload("/images/file.png", file_bytes).await?;
|
||||||
///
|
|
||||||
/// Ok(())
|
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn upload<T: AsRef<str>>(&self, path: T, file: Bytes) -> Result<(), Error> {
|
pub async fn upload<T: AsRef<str>>(&self, path: T, file: Bytes) -> Result<(), Error> {
|
||||||
|
|
22
src/lib.rs
22
src/lib.rs
|
@ -1,22 +1,4 @@
|
||||||
//! This library provides access to the Bunny API asynchronously using tokio, it's not fully implemented but PRs are welcome.
|
//! 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)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -41,9 +23,7 @@ impl Client {
|
||||||
///
|
///
|
||||||
/// #[tokio::main]
|
/// #[tokio::main]
|
||||||
/// async fn main() -> Result<(), Error> {
|
/// async fn main() -> Result<(), Error> {
|
||||||
/// let mut client = Client::new("api_key").await?;
|
/// let mut client = Client::new("api_key")?;
|
||||||
///
|
|
||||||
/// Ok(())
|
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn new<T: AsRef<str>>(api_key: T) -> Result<Self, Error> {
|
pub async fn new<T: AsRef<str>>(api_key: T) -> Result<Self, Error> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue