tmdb_sans_io/lib.rs
1//! # The Movie Database
2//!
3//! 
4//!
5//! This is a fork of [tmdb (Cir0X/tmdb-rs)](https://gitlab.com/Cir0X/tmdb-rs), following the [sans-io](https://sans-io.readthedocs.io/) approach to let you build a custom wrapper around [TMDb API](https://developers.themoviedb.org/3).
6//!
7//! Bring your own I/O stack!
8//!
9//! ## Motivation
10//!
11//! Why yet another [TMDb API library](https://lib.rs/search?q=tmdb) written in Rust?
12//!
13//! For a throw-away hobby project, I needed to access [TMDb API](https://developers.themoviedb.org/3):
14//! - The search on [lib.rs](https://lib.rs/search?q=tmdb) lists several crate implementations, great!
15//! - Looking among the results (at the time of writing) some require async runtimes... but [tmdb (Cir0X/tmdb-rs)](https://gitlab.com/Cir0X/tmdb-rs) doesn't, nice!
16//! - N.B. I'm not hating on async, just for this project pulling an async runtime seemed like overkill. If I did pull in an async runtime, I wanted it to be on my terms.
17//! - Running [`cargo audit`](https://crates.io/crates/cargo-audit), it seems one dependency of the chosen library (the latest `reqwest` version 0.9.24 per the semver range, from 2019-12-11) has security advisories.
18//!
19//! The situation is understandable: an older but still working API access library (last updated in 2021) that uses an older version of HTTP client library is bound to have a few security vulnerabilities reported deep in their dependency tree.
20//!
21//! Security advisories (in this case, DDOS vulnerabilities) may not be critical for a hobby project but are still not ideal.
22//!
23//! Instead of manually patching the API access library to use an updated HTTP client library, why not decouple the API models from the HTTP client?
24//!
25//! Credit goes to the original authors for the data models, and API design. Building upon that, the [`finish`](`themoviedb::Executable`) method is crudely bolted on, returning an [`HttpGet`](`themoviedb::HttpGet`) struct containing the URL to be queried and a `receive_response` method to parse the JSON response.
26
27pub mod model;
28pub mod themoviedb;