refactor!: refactored response models
doc: documented all public methods
This commit is contained in:
parent
4c1876cb55
commit
f526ab38eb
37 changed files with 600 additions and 255 deletions
|
|
@ -1,40 +1,9 @@
|
|||
//! Query parameters
|
||||
|
||||
mod stream_filter;
|
||||
|
||||
pub mod locale;
|
||||
pub mod search_filter;
|
||||
|
||||
pub use locale::{Country, Language};
|
||||
use serde::{Deserialize, Serialize};
|
||||
pub use stream_filter::StreamFilter;
|
||||
|
||||
/// YouTube API endpoint to fetch continuations from
|
||||
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[non_exhaustive]
|
||||
pub enum ContinuationEndpoint {
|
||||
Browse,
|
||||
Search,
|
||||
Next,
|
||||
MusicBrowse,
|
||||
MusicSearch,
|
||||
MusicNext,
|
||||
}
|
||||
|
||||
impl ContinuationEndpoint {
|
||||
pub(crate) fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
ContinuationEndpoint::Browse | ContinuationEndpoint::MusicBrowse => "browse",
|
||||
ContinuationEndpoint::Search | ContinuationEndpoint::MusicSearch => "search",
|
||||
ContinuationEndpoint::Next | ContinuationEndpoint::MusicNext => "next",
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn is_music(self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
ContinuationEndpoint::MusicBrowse
|
||||
| ContinuationEndpoint::MusicSearch
|
||||
| ContinuationEndpoint::MusicNext
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue