podcast_api/lib.rs
1//! Official library for accessing the [Listen API](https://www.listennotes.com/api) by [Listen Notes](https://www.listennotes.com).
2//!
3//! # Quick Start Example
4//!
5//! ```
6//! use serde_json::json;
7//!
8//! #[tokio::main]
9//! async fn main() {
10//! // Api Key (None => Test API, Some(key) => Production API)
11//! let api_key = None;
12//!
13//! // Create client
14//! let client = podcast_api::Client::new(api_key);
15//!
16//! // Call API
17//! match client
18//! .typeahead(&json!({
19//! "q": "startup",
20//! "show_podcasts": 1
21//! }))
22//! .await
23//! {
24//! Ok(response) => {
25//! println!("Successfully called \"typeahead\" endpoint.");
26//! println!("Response Body:");
27//! println!("{:?}", response);
28//! }
29//! Err(err) => {
30//! println!("Error calling \"typeahead\" endpoint:");
31//! println!("{:?},", err);
32//! }
33//! };
34//! }
35//! ```
36#![deny(missing_docs)]
37
38mod api;
39mod client;
40mod error;
41
42use api::Api;
43
44pub use client::Client;
45pub use client::Response;
46pub use error::Error;
47/// Result for API calls from [`Client`]
48pub type Result<T> = std::result::Result<T, error::Error>;