wallabag_api/
lib.rs

1// Copyright 2018 Samuel Walladge <samuel@swalladge.net>
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! # Wallabag API
5//!
6//! Provides full type-safe async access to a [Wallabag](https://wallabag.org/) API server.
7//! Contains methods for creating, reading, modifying, and deleting entries, annotations, and tags.
8//!
9//!
10//! Example code to retrieve and print all starred entries.
11//! ```no_run
12//! use std::env;
13//!
14//! use wallabag_api::types::{Config, EntriesFilter, SortBy, SortOrder};
15//! use wallabag_api::Client;
16//!
17//! async fn run_example() {
18//!     let config = Config {
19//!         client_id: env::var("WALLABAG_CLIENT_ID").expect("WALLABAG_CLIENT_ID not set"),
20//!         client_secret: env::var("WALLABAG_CLIENT_SECRET").expect("WALLABAG_CLIENT_SECRET not set"),
21//!         username: env::var("WALLABAG_USERNAME").expect("WALLABAG_USERNAME not set"),
22//!         password: env::var("WALLABAG_PASSWORD").expect("WALLABAG_PASSWORD not set"),
23//!         base_url: env::var("WALLABAG_URL").expect("WALLABAG_URL not set"),
24//!     };
25//!
26//!     println!("{:#?}", config);
27//!
28//!     let mut client = Client::new(config);
29//!
30//!     let filter = EntriesFilter {
31//!         archive: None,
32//!         starred: Some(true),
33//!         sort: SortBy::Created,
34//!         order: SortOrder::Desc,
35//!         tags: vec![],
36//!         since: 0,
37//!         public: None,
38//!         per_page: None,
39//!     };
40//!
41//!     let response = client.get_entries_with_filter(&filter).await;
42//!     match response {
43//!         Err(e) => {
44//!             println!("Error: {}", e);
45//!         }
46//!         Ok(entries) => {
47//!             // do something with the entries!
48//!             for entry in entries {
49//!                 println!(
50//!                     "{} | {} | Starred at {}",
51//!                     entry.id,
52//!                     entry.title.unwrap_or("Untitled".to_owned()),
53//!                     entry.starred_at.unwrap()
54//!                 );
55//!             }
56//!         }
57//!     }
58//! }
59//!
60//! fn main() {
61//!    async_std::task::block_on(run_example())
62//! }
63//! ```
64
65mod client;
66pub mod errors;
67pub mod types;
68mod utils;
69
70pub use crate::client::Client;
71pub use crate::errors::ClientError;