yt_api/lib.rs
1//! # yt-api
2//!
3//! With the `yt-api` crate you can interact asynchronously with the youtube-api.
4//!
5//! ## Performing a search query
6//!
7//! To perform a search query, you can create a [`SearchList`][search_list] query.
8//!
9//! ```rust
10//! # use yt_api::{
11//! # search::SearchList,
12//! # ApiKey,
13//! # };
14//! #
15//! # futures::executor::block_on(async {
16//! let result = SearchList::new(ApiKey::new("your-youtube-api-key")).q("rust lang").await;
17//! # });
18//! ```
19//!
20//! [search_list]: ./search/struct.SearchList.html
21//! [search_perform]: ./search/struct.SearchList.html#method.perform
22
23pub mod playlistitems;
24pub mod search;
25
26use serde::Serialize;
27
28#[derive(Debug, Clone, Serialize)]
29pub struct ApiKey(String);
30
31impl ApiKey {
32 pub fn new(key: impl Into<String>) -> Self {
33 Self(key.into())
34 }
35}