docs: fix up docs related to getting started, etc.
This commit is contained in:
parent
49605fb854
commit
99bb02f10c
2 changed files with 26 additions and 2 deletions
|
@ -101,9 +101,11 @@ impl<'a> Storage {
|
||||||
///
|
///
|
||||||
/// #[tokio::main]
|
/// #[tokio::main]
|
||||||
/// async fn main() -> Result<(), Error> {
|
/// 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");
|
/// 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> {
|
||||||
|
@ -130,6 +132,8 @@ 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,4 +1,22 @@
|
||||||
//! 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;
|
||||||
|
@ -23,7 +41,9 @@ impl Client {
|
||||||
///
|
///
|
||||||
/// #[tokio::main]
|
/// #[tokio::main]
|
||||||
/// async fn main() -> Result<(), Error> {
|
/// 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<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