aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trakt-rs/src/api.rs1
-rw-r--r--trakt-rs/src/api/country.rs39
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,
+ }
+}