Skip to main content

tmdb_rs/endpoints/
configuration.rs

1use serde::Deserialize;
2
3use crate::{CountryCode, Language};
4
5#[derive(Debug, Clone, Deserialize)]
6pub struct ImageConfig {
7    pub base_url: String,
8    pub secure_base_url: String,
9    pub backdrop_sizes: Vec<String>,
10    pub logo_sizes: Vec<String>,
11    pub poster_sizes: Vec<String>,
12    pub profile_sizes: Vec<String>,
13    pub still_sizes: Vec<String>,
14}
15
16/// the API-wide configuration: image base urls and sizes, change keys
17#[derive(Debug, Clone, Deserialize)]
18pub struct Configuration {
19    pub images: ImageConfig,
20    pub change_keys: Vec<String>,
21}
22
23#[derive(Debug, Clone, Deserialize)]
24pub struct CountryInfo {
25    #[serde(rename = "iso_3166_1")]
26    pub country: CountryCode,
27    pub english_name: String,
28    pub native_name: String,
29}
30
31#[derive(Debug, Clone, Deserialize)]
32pub struct DepartmentJobs {
33    pub department: String,
34    pub jobs: Vec<String>,
35}
36
37#[derive(Debug, Clone, Deserialize)]
38pub struct LanguageInfo {
39    #[serde(rename = "iso_639_1")]
40    pub language: Language,
41    pub english_name: String,
42    pub name: String,
43}
44
45#[derive(Debug, Clone, Deserialize)]
46pub struct Timezone {
47    #[serde(rename = "iso_3166_1")]
48    pub country: CountryCode,
49    pub zones: Vec<String>,
50}
51
52endpoint! {
53    /// the API-wide configuration
54    configuration(): GET "/configuration" => Configuration
55}
56
57endpoint! {
58    /// the countries TMDB knows
59    countries(): GET "/configuration/countries" => Vec<CountryInfo>
60}
61
62endpoint! {
63    /// the departments and jobs credits use
64    jobs(): GET "/configuration/jobs" => Vec<DepartmentJobs>
65}
66
67endpoint! {
68    /// the languages TMDB knows
69    languages(): GET "/configuration/languages" => Vec<LanguageInfo>
70}
71
72endpoint! {
73    /// the languages translations can be requested in
74    primary_translations(): GET "/configuration/primary_translations" => Vec<String>
75}
76
77endpoint! {
78    /// the timezones TMDB knows, by country
79    timezones(): GET "/configuration/timezones" => Vec<Timezone>
80}