Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/terror/readwise
A rust wrapper for the Readwise API
https://github.com/terror/readwise
api-wrapper readwise rust
Last synced: 3 months ago
JSON representation
A rust wrapper for the Readwise API
- Host: GitHub
- URL: https://github.com/terror/readwise
- Owner: terror
- License: cc0-1.0
- Created: 2021-02-07T21:19:18.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-15T15:27:20.000Z (about 2 years ago)
- Last Synced: 2024-10-11T06:10:59.485Z (3 months ago)
- Topics: api-wrapper, readwise, rust
- Language: Rust
- Homepage:
- Size: 88.9 KB
- Stars: 8
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE
Awesome Lists containing this project
- awesome-readwise - readwise - A Rust wrapper for the Readwise API. (Client Libraries)
README
## Readwise
A rust wrapper for the Readwise API.
### Installation
Simply add readwise to your Cargo.toml file:
```
readwise = "0.4.0"
```### Example
Here is a small example showcasing the main functionality of the library.
```rust
use {
dotenv::dotenv,
readwise::client::Client,
std::{collections::HashMap, env},
};fn main() {
dotenv().ok();let client = Client::new(&env::var("ACCESS_TOKEN").unwrap()).unwrap();
// Fetch all books on page 1
for book in client.books(1).unwrap() {
println!("{}", book.title);
}// Fetch all highlights on page 1
for highlight in client.highlights(1).unwrap() {
println!("{}", highlight.id);
}// Create highlight(s)
let mut new_highlight = HashMap::new();
new_highlight.insert("text", "hello world!");for highlight in client.create_highlights(vec![new_highlight]).unwrap() {
println!("{}", highlight.text);
}// Update a highlight by ID
let mut fields = HashMap::new();
fields.insert("text", "hello, world!");
client.update_highlight(138105649, fields).unwrap();// Delete a highlight by ID
client.delete_highlight(136887156).unwrap();
}
```