Skip to content

Commit 2f31123

Browse files
committed
Update readme and fix deps
1 parent 781172c commit 2f31123

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

crates/octocrab-wasm/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ edition = "2024"
55

66
[dependencies]
77
octocrab = { version = "0.45.0", default-features = false }
8+
9+
[target.'cfg(target_arch = "wasm32")'.dependencies]
810
http-body = "1.0.1"
911
tower = "0.5.2"
1012
http = "1.3.1"

crates/octocrab-wasm/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,21 @@
22

33
This is a thin wrapper around [octocrab](https://crates.io/crates/octocrab) that
44
adds support for using octocrab in wasm based on reqwest.
5+
6+
### Usage
7+
8+
This crate exports a builder that works natively and in wasm:
9+
```rust
10+
let mut client = octocrab_wasm::builder()
11+
.build()
12+
.expect("Failed to build Octocrab client");
13+
14+
// Optionally set a GitHub auth token
15+
if let Some(token) = &auth_token {
16+
client = client
17+
.user_access_token(token.to_owned())
18+
.expect("Failed to set token");
19+
}
20+
21+
// Now do some requests!
22+
```

0 commit comments

Comments
 (0)