aboutsummaryrefslogtreecommitdiff
path: root/trakt-rs/src/api/certifications.rs
blob: 482ac1cd4954d75706d3109a97b690baa8a225eb (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
38
39
40
41
42
//! Certifications
//!
//! <https://trakt.docs.apiary.io/#reference/certifications/list>

pub mod list {
    //! List Certifications
    //!
    //! <https://trakt.docs.apiary.io/#reference/certifications/list/get-certifications>

    use std::collections::HashMap;

    use serde::Serialize;
    use smol_str::SmolStr;

    use crate::smo::Country;

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

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

    #[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, trakt_macros::Response)]
    pub struct Response(pub HashMap<Country, Certification>);

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