1use crate::endpoints::movie::MovieShort;
2use crate::endpoints::tv::TvShort;
3use crate::{CountryCode, Date, Language, Page};
4use strum::Display;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Display)]
8pub enum MovieSort {
9 #[strum(serialize = "original_title.asc")]
10 OriginalTitleAsc,
11 #[strum(serialize = "original_title.desc")]
12 OriginalTitleDesc,
13 #[strum(serialize = "popularity.asc")]
14 PopularityAsc,
15 #[strum(serialize = "popularity.desc")]
16 PopularityDesc,
17 #[strum(serialize = "revenue.asc")]
18 RevenueAsc,
19 #[strum(serialize = "revenue.desc")]
20 RevenueDesc,
21 #[strum(serialize = "primary_release_date.asc")]
22 PrimaryReleaseDateAsc,
23 #[strum(serialize = "primary_release_date.desc")]
24 PrimaryReleaseDateDesc,
25 #[strum(serialize = "title.asc")]
26 TitleAsc,
27 #[strum(serialize = "title.desc")]
28 TitleDesc,
29 #[strum(serialize = "vote_average.asc")]
30 VoteAverageAsc,
31 #[strum(serialize = "vote_average.desc")]
32 VoteAverageDesc,
33 #[strum(serialize = "vote_count.asc")]
34 VoteCountAsc,
35 #[strum(serialize = "vote_count.desc")]
36 VoteCountDesc,
37}
38
39#[derive(Debug, Clone, Copy, PartialEq, Eq, Display)]
41pub enum TvSort {
42 #[strum(serialize = "first_air_date.asc")]
43 FirstAirDateAsc,
44 #[strum(serialize = "first_air_date.desc")]
45 FirstAirDateDesc,
46 #[strum(serialize = "name.asc")]
47 NameAsc,
48 #[strum(serialize = "name.desc")]
49 NameDesc,
50 #[strum(serialize = "original_name.asc")]
51 OriginalNameAsc,
52 #[strum(serialize = "original_name.desc")]
53 OriginalNameDesc,
54 #[strum(serialize = "popularity.asc")]
55 PopularityAsc,
56 #[strum(serialize = "popularity.desc")]
57 PopularityDesc,
58 #[strum(serialize = "vote_average.asc")]
59 VoteAverageAsc,
60 #[strum(serialize = "vote_average.desc")]
61 VoteAverageDesc,
62 #[strum(serialize = "vote_count.asc")]
63 VoteCountAsc,
64 #[strum(serialize = "vote_count.desc")]
65 VoteCountDesc,
66}
67
68endpoint! {
69 discover_movies(): GET "/discover/movie" => Page<MovieShort> {
71 params {
72 language: Language,
73 page: u32,
74 sort_by: MovieSort,
75 include_adult: bool,
76 include_video: bool,
77 region: CountryCode,
78 watch_region: CountryCode,
79 with_watch_providers: Vec<u64>,
80 with_watch_monetization_types: &str,
81 with_genres: Vec<u64>,
82 without_genres: Vec<u64>,
83 with_keywords: Vec<u64>,
84 without_keywords: Vec<u64>,
85 with_cast: Vec<u64>,
86 with_crew: Vec<u64>,
87 with_people: Vec<u64>,
88 with_companies: Vec<u64>,
89 with_networks: Vec<u64>,
90 with_origin_country: CountryCode,
91 with_original_language: Language,
92 certification: &str,
93 certification_country: CountryCode,
94 primary_release_year: u32,
95 year: u32,
96 vote_average_gte: f64,
97 vote_average_lte: f64,
98 vote_count_gte: f64,
99 vote_count_lte: f64,
100 with_runtime_gte: u32,
101 with_runtime_lte: u32,
102 }
103 }
104}
105
106endpoint! {
107 discover_tv(): GET "/discover/tv" => Page<TvShort> {
109 params {
110 language: Language,
111 page: u32,
112 sort_by: TvSort,
113 include_adult: bool,
114 include_null_first_air_dates: bool,
115 watch_region: CountryCode,
116 with_watch_providers: Vec<u64>,
117 with_watch_monetization_types: &str,
118 with_genres: Vec<u64>,
119 without_genres: Vec<u64>,
120 with_keywords: Vec<u64>,
121 without_keywords: Vec<u64>,
122 with_companies: Vec<u64>,
123 with_networks: Vec<u64>,
124 with_origin_country: CountryCode,
125 with_original_language: Language,
126 with_status: &str,
127 with_type: &str,
128 air_date_gte: Date,
129 air_date_lte: Date,
130 first_air_date_year: u32,
131 vote_average_gte: f64,
132 vote_average_lte: f64,
133 vote_count_gte: f64,
134 vote_count_lte: f64,
135 with_runtime_gte: u32,
136 with_runtime_lte: u32,
137 }
138 }
139}