pub struct Client { /* private fields */ }
Implementations
sourceimpl Client
impl Client
sourcepub fn new(access_token: &str) -> Result<Self, Error>
pub fn new(access_token: &str) -> Result<Self, Error>
Create and authenticate a new Readwise client from a specified access token
use readwise::client::Client;
let client = Client::new("token").unwrap();
sourcepub fn books(&self, page: u64) -> Result<Vec<Book>, Error>
pub fn books(&self, page: u64) -> Result<Vec<Book>, Error>
Fetch all books from a specified page
use readwise::client::Client;
let client = Client::new("token").unwrap();
let books = client.books(1).unwrap();
sourcepub fn highlights(&self, page: u64) -> Result<Vec<Highlight>, Error>
pub fn highlights(&self, page: u64) -> Result<Vec<Highlight>, Error>
Fetch all highlights from a specified page
use readwise::client::Client;
let client = Client::new("token").unwrap();
let highlights = client.highlights(1).unwrap();
sourcepub fn book(&self, id: u64) -> Result<Book, Error>
pub fn book(&self, id: u64) -> Result<Book, Error>
Fetch a single book by identifier
use readwise::client::Client;
let client = Client::new("token").unwrap();
let book = client.book(1).unwrap();
sourcepub fn highlight(&self, id: u64) -> Result<Highlight, Error>
pub fn highlight(&self, id: u64) -> Result<Highlight, Error>
Fetch a single highlight by identifier
use readwise::client::Client;
let client = Client::new("token").unwrap();
let highlight = client.highlight(1).unwrap();
sourcepub fn create_highlights(
&self,
highlights: Vec<HashMap<&str, &str>>
) -> Result<Vec<Highlight>, Error>
pub fn create_highlights(
&self,
highlights: Vec<HashMap<&str, &str>>
) -> Result<Vec<Highlight>, Error>
Create and return one or more highlights
use {
std::collections::HashMap,
readwise::client::Client
};
let client = Client::new("token").unwrap();
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);
}
sourcepub fn update_highlight(
&self,
id: i64,
body: HashMap<&str, &str>
) -> Result<Highlight, Error>
pub fn update_highlight(
&self,
id: i64,
body: HashMap<&str, &str>
) -> Result<Highlight, Error>
Update a single highlight by identifier
use {
std::collections::HashMap,
readwise::client::Client
};
let client = Client::new("token").unwrap();
let mut fields = HashMap::new();
fields.insert("text", "hello, world!");
client.update_highlight(1, fields).unwrap();
Auto Trait Implementations
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more