fakeyou_api/lib.rs
1#![warn(unused_crate_dependencies)]
2#![forbid(unsafe_code)]
3#![warn(clippy::all)]
4
5//!<div align="center">
6//! <!-- Build -->
7//! <img src="https://img.shields.io/github/actions/workflow/status/alexjercan/fakeyou-api/rust.yml?style=flat-square"
8//! alt="Github Worflow Status" />
9//! <!-- Version -->
10//! <a href="https://crates.io/crates/fakeyou-api">
11//! <img src="https://img.shields.io/crates/v/fakeyou-api?style=flat-square"
12//! alt="Crates.io version" />
13//! </a>
14//! <!-- Docs -->
15//! <a href="https://docs.rs/fakeyou-api">
16//! <img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
17//! alt="docs.rs docs" />
18//! </a>
19//! <!-- Downloads -->
20//! <a href="https://crates.io/crates/fakeyou-api">
21//! <img src="https://img.shields.io/crates/d/fakeyou-api?style=flat-square"
22//! alt="Crates.io downloads" />
23//! </a>
24//! <!-- License -->
25//! <a href="https://github.com/alexjercan/fakeyou-api/blob/master/LICENSE">
26//! <img src="https://img.shields.io/github/license/alexjercan/fakeyou-api?style=flat-square"
27//! alt="Crates.io downloads" />
28//! </a>
29//!</div>
30//!
31//! A very simple Rust library for FakeYou API.
32//!
33//! ## API
34//!
35//! Check the [official](https://docs.fakeyou.com/) API reference.
36//!
37//! |API|Support|
38//! |---|---|
39//! |Text to Speech|✔️|
40//! |Voices|✔️|
41//! |Categories|✔️|
42//!
43//! ## Usage
44//!
45//! Install the library using the Cargo.toml file or run the following command.
46//!
47//! ```console
48//! cargo add fakeyou-api
49//! ```
50//!
51//! Export your API key into the environment variables (if you use the paid version).
52//!
53//! ```console
54//! export FAKEYOU_API_KEY=...
55//! ```
56//!
57//! Then use the crate in your Rust code:
58//!
59//! ```no_run
60//! # fn main() {
61//! // Import the dependencies
62//! use fakeyou_api::{tts::InferenceBody, util::tts::TtsApiSync, *};
63//!
64//! // You can create a default client without any api key.
65//! // You can also load the API key from environment FAKEYOU_API_KEY.
66//! // You can also hadcode through `Auth::new(<your_api_key>)`, but it is not recommended.
67//! let auth = Auth::default();
68//! let fakeyou = FakeYou::new(auth, FAKEYOU_API_URL);
69//!
70//! // Create the TTS body
71//! let inference_body =
72//! InferenceBody::new("TM:ebgxj0j4fvzp", "Hello, World! What should we do today?");
73//!
74//! // Call the TTS API
75//! // This uses the util module of this crate and will block the thread until the task is done
76//! let output_result = fakeyou.create_tts_task(&inference_body).unwrap();
77//!
78//! // Do what you need with the audio file
79//! std::fs::write("output.wav", output_result.bytes).unwrap();
80//! # }
81//! ```
82//!
83//! ## License
84//! This project is licensed under MIT
85//!
86
87pub mod apis;
88pub use apis::*;
89
90pub mod fakeyou;
91pub use fakeyou::*;
92
93pub mod error;
94pub use error::*;
95
96pub mod util;