diff options
author | 2024-02-18 23:43:07 -0800 | |
---|---|---|
committer | 2024-02-18 23:43:07 -0800 | |
commit | 00496127d33408996682df488c109d937d2305de (patch) | |
tree | 552cbe858fb33bef253090674c5a717f4da25411 | |
parent | 3395f4c0f92f03f38082e0cc653bf8e66940d5b3 (diff) | |
download | trakt-00496127d33408996682df488c109d937d2305de.tar.gz trakt-00496127d33408996682df488c109d937d2305de.tar.zst trakt-00496127d33408996682df488c109d937d2305de.zip |
Adds country endpoints
-rw-r--r-- | trakt-rs/src/api.rs | 1 | ||||
-rw-r--r-- | trakt-rs/src/api/country.rs | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/trakt-rs/src/api.rs b/trakt-rs/src/api.rs index 3c990da..dc187cb 100644 --- a/trakt-rs/src/api.rs +++ b/trakt-rs/src/api.rs @@ -11,5 +11,6 @@ pub mod calendars; pub mod certifications; pub mod checkin; pub mod comments; +pub mod country; pub mod movies; pub mod shows; diff --git a/trakt-rs/src/api/country.rs b/trakt-rs/src/api/country.rs new file mode 100644 index 0000000..477a9e5 --- /dev/null +++ b/trakt-rs/src/api/country.rs @@ -0,0 +1,39 @@ +//! Country-related endpoints +//! +//! <https://trakt.docs.apiary.io/#reference/countries/list> + +pub mod list { + //! List all countries + //! + //! <https://trakt.docs.apiary.io/#reference/countries/list/get-countries> + + use serde::{Deserialize, Serialize}; + use smol_str::SmolStr; + + use crate::smo::Country; + + #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, trakt_macros::Request)] + #[trakt( + response = Response, + endpoint = "/countries/{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, 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 code: Country, + } +} |