1use std::borrow::Cow;
2
3pub mod country;
4pub mod credits;
5pub mod image;
6pub mod keyword;
7pub mod language;
8pub mod release_date;
9pub mod status;
10pub mod video;
11
12#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
13pub struct PaginatedResult<T> {
14 pub page: u64,
15 pub total_results: u64,
16 pub total_pages: u64,
17 pub results: Vec<T>,
18}
19
20#[derive(Clone, Debug, Deserialize, Serialize)]
21pub struct EntityResults<V> {
22 pub id: u64,
23 pub results: V,
24}
25
26#[derive(Clone, Debug, Deserialize, Serialize)]
27pub struct Results<V> {
28 pub results: V,
29}
30
31#[derive(Clone, Debug, Default, Serialize)]
32pub struct LanguageParams<'a> {
33 #[serde(skip_serializing_if = "Option::is_none")]
36 pub language: Option<Cow<'a, str>>,
37}
38
39impl<'a> LanguageParams<'a> {
40 pub fn set_language(&mut self, value: impl Into<Cow<'a, str>>) {
41 self.language = Some(value.into());
42 }
43
44 pub fn with_language(mut self, value: impl Into<Cow<'a, str>>) -> Self {
45 self.set_language(value);
46 self
47 }
48}
49
50#[derive(Clone, Debug, Default, serde::Serialize)]
51pub struct LanguagePageParams<'a> {
52 #[serde(skip_serializing_if = "Option::is_none")]
55 pub language: Option<Cow<'a, str>>,
56 #[serde(skip_serializing_if = "Option::is_none")]
58 pub page: Option<u32>,
59}
60
61impl<'a> LanguagePageParams<'a> {
62 pub fn set_language(&mut self, value: impl Into<Cow<'a, str>>) {
63 self.language = Some(value.into());
64 }
65
66 pub fn with_language(mut self, value: impl Into<Cow<'a, str>>) -> Self {
67 self.set_language(value);
68 self
69 }
70
71 pub fn set_page(&mut self, value: u32) {
72 self.page = Some(value);
73 }
74
75 pub fn with_page(mut self, value: u32) -> Self {
76 self.set_page(value);
77 self
78 }
79}