Skip to content

Commit

Permalink
doc: 文档完善
Browse files Browse the repository at this point in the history
  • Loading branch information
tu6ge committed Aug 30, 2024
1 parent 5105877 commit b6aa9f5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,31 @@

**巨大更新,之前使用过的,慎重升级 0.13**

目前的实现,代码将大大简化,api接口也更加起清晰,使用了有限的 rust 语言特性,所以接口更加统一,
目前的实现,代码将大大简化,api 接口也更加起清晰,使用了有限的 rust 语言特性,所以接口更加统一,
大大减少了外部依赖

> 使用本 lib 创建的 oss 命令行工具:[tu6ge/oss-cli](https://github.com/tu6ge/oss-cli),也算是本库的一个演示项目
详细使用案例如下:

```rust
use aliyun_oss_client::{types::ObjectQuery, Client, EndPoint};

async fn run() -> Result<(), aliyun_oss_client::Error> {
let client = Client::from_env()?;

let buckes = client.get_buckets(&EndPoint::CN_QINGDAO).await?;

let objects = buckes[0].get_objects(&ObjectQuery::new(), &client).await?;

let obj_info = objects[0].get_info(&client).await?;

Ok(())
}
```

# RFC

get Buckets

```rust
Expand All @@ -33,6 +51,7 @@ impl Client {
```

get bucket info;

```rust
struct Bucket {
name: String,
Expand Down Expand Up @@ -62,6 +81,7 @@ impl Bucket{
}
}
```

get object info

```rust
Expand All @@ -82,4 +102,3 @@ impl Object {
}
}
```

17 changes: 17 additions & 0 deletions examples/demo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use aliyun_oss_client::{types::ObjectQuery, Client, EndPoint};

async fn run() -> Result<(), aliyun_oss_client::Error> {
let client = Client::from_env()?;

let buckes = client.get_buckets(&EndPoint::CN_QINGDAO).await?;

let objects = buckes[0].get_objects(&ObjectQuery::new(), &client).await?;

let obj_info = objects[0].get_info(&client).await?;

Ok(())
}

pub fn main() {
// run().unwrap();
}

0 comments on commit b6aa9f5

Please sign in to comment.