aboutsummaryrefslogtreecommitdiff
path: root/trakt-rs/src/api/genres.rs
blob: 671fe028c2304b73e4261594e85198192d83ce43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Genre related endpoints
//!
//! <https://trakt.docs.apiary.io/#reference/genres>

pub mod list {
    //! Get genres
    //!
    //! <https://trakt.docs.apiary.io/#reference/genres/list/get-genres>

    use serde::{Deserialize, Serialize};
    use smol_str::SmolStr;

    #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, trakt_macros::Request)]
    #[trakt(
    response = Response,
    endpoint = "/genres/{tp}",
    )]
    pub struct Request {
        pub tp: Type,
    }

    #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize)]
    #[serde(rename_all = "lowercase")]
    pub enum Type {
        Movies,
        Shows,
    }

    #[derive(Debug, Clone, PartialEq, Eq, Hash, trakt_macros::Response)]
    pub struct Response(Vec<ResponseItem>);

    #[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize)]
    pub struct ResponseItem {
        pub name: SmolStr,
        pub slug: SmolStr,
    }
}