tmdb_rs/endpoints/
credit.rs1use serde::Deserialize;
2
3use crate::endpoints::person::PersonShort;
4use crate::{Backdrop, Poster, Profile, Still};
5
6#[derive(Debug, Clone, Deserialize)]
7pub struct CastMember {
8 pub name: String,
9 pub character: Option<String>,
10 #[serde(rename = "profile_path")]
11 pub profile: Option<Profile>,
12 pub order: Option<u32>,
13 pub credit_id: String,
14}
15
16#[derive(Debug, Clone, Deserialize)]
17pub struct CrewMember {
18 pub name: String,
19 pub job: String,
20 pub department: String,
21 #[serde(rename = "profile_path")]
22 pub profile: Option<Profile>,
23 pub credit_id: String,
24}
25
26#[derive(Debug, Clone, Deserialize)]
27pub struct Credits {
28 pub cast: Vec<CastMember>,
29 pub crew: Vec<CrewMember>,
30}
31
32#[derive(Debug, Clone, Deserialize)]
34pub struct CreditSeason {
35 pub season_number: u32,
36 pub name: String,
37 #[serde(rename = "poster_path")]
38 pub poster: Option<Poster>,
39 pub air_date: Option<String>,
40}
41
42#[derive(Debug, Clone, Deserialize)]
44pub struct CreditEpisode {
45 pub id: u64,
46 pub name: String,
47 pub episode_number: u32,
48 pub season_number: u32,
49 pub air_date: Option<String>,
50 #[serde(rename = "still_path")]
51 pub still: Option<Still>,
52 pub overview: Option<String>,
53}
54
55#[derive(Debug, Clone, Deserialize)]
57pub struct CreditMovie {
58 pub id: u64,
59 #[serde(rename = "title")]
60 pub name: String,
61 #[serde(rename = "original_title")]
62 pub original_name: String,
63 #[serde(rename = "poster_path")]
64 pub poster: Option<Poster>,
65 #[serde(rename = "backdrop_path")]
66 pub backdrop: Option<Backdrop>,
67}
68
69#[derive(Debug, Clone, Deserialize)]
71pub struct CreditSeries {
72 pub id: u64,
73 pub name: String,
74 pub original_name: String,
75 #[serde(rename = "poster_path")]
76 pub poster: Option<Poster>,
77 #[serde(rename = "backdrop_path")]
78 pub backdrop: Option<Backdrop>,
79 #[serde(default)]
80 pub seasons: Vec<CreditSeason>,
81 #[serde(default)]
82 pub episodes: Vec<CreditEpisode>,
83 pub character: Option<String>,
84}
85
86#[derive(Debug, Clone, Deserialize)]
88#[serde(tag = "media_type", rename_all = "snake_case")]
89pub enum CreditMedia {
90 Movie(CreditMovie),
91 Tv(CreditSeries),
92}
93
94#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)]
96#[serde(rename_all = "snake_case")]
97pub enum CreditType {
98 Cast,
99 Crew,
100}
101
102#[derive(Debug, Clone, Deserialize)]
104pub struct CreditDetails {
105 pub id: String,
106 pub credit_type: CreditType,
107 pub department: String,
108 pub job: String,
109 pub media: CreditMedia,
110 pub person: PersonShort,
111}
112
113endpoint! {
114 credit(id: &str): GET "/credit/{id}" => CreditDetails
116}