@@ -8,67 +8,89 @@ use serde::{
88 Deserialize ,
99} ;
1010
11- #[ derive( Deserialize , Debug ) ]
11+ #[ derive( Deserialize , Debug , Default , Clone ) ]
1212pub struct StationContext {
13- pub uri : Option < String > ,
14- pub next_page_url : String ,
13+ pub uri : String ,
14+ pub title : String ,
15+ #[ serde( rename = "titleUri" ) ]
16+ pub title_uri : String ,
17+ pub subtitles : Vec < SubtitleContext > ,
18+ #[ serde( rename = "imageUri" ) ]
19+ pub image_uri : String ,
20+ pub seeds : Vec < String > ,
1521 #[ serde( deserialize_with = "deserialize_protobuf_TrackRef" ) ]
1622 pub tracks : Vec < TrackRef > ,
17- // Not required for core functionality
18- // pub seeds: Vec<String>,
19- // #[serde(rename = "imageUri")]
20- // pub image_uri: String,
21- // pub subtitle: Option<String>,
22- // pub subtitles: Vec<String>,
23- // #[serde(rename = "subtitleUri")]
24- // pub subtitle_uri: Option<String>,
25- // pub title: String,
26- // #[serde(rename = "titleUri")]
27- // pub title_uri: String,
28- // pub related_artists: Vec<ArtistContext>,
23+ pub next_page_url : String ,
24+ pub correlation_id : String ,
25+ pub related_artists : Vec < ArtistContext > ,
2926}
3027
31- #[ derive( Deserialize , Debug ) ]
28+ #[ derive( Deserialize , Debug , Default , Clone ) ]
3229pub struct PageContext {
33- pub uri : String ,
34- pub next_page_url : String ,
3530 #[ serde( deserialize_with = "deserialize_protobuf_TrackRef" ) ]
3631 pub tracks : Vec < TrackRef > ,
37- // Not required for core functionality
38- // pub url: String,
39- // // pub restrictions:
32+ pub next_page_url : String ,
33+ pub correlation_id : String ,
4034}
4135
42- #[ derive( Deserialize , Debug ) ]
36+ #[ derive( Deserialize , Debug , Default , Clone ) ]
4337pub struct TrackContext {
44- #[ serde( rename = "original_gid" ) ]
45- pub gid : String ,
4638 pub uri : String ,
4739 pub uid : String ,
48- // Not required for core functionality
49- // pub album_uri: String,
50- // pub artist_uri: String,
51- // pub metadata: MetadataContext,
40+ pub artist_uri : String ,
41+ pub album_uri : String ,
42+ #[ serde( rename = "original_gid" ) ]
43+ pub gid : String ,
44+ pub metadata : MetadataContext ,
45+ pub name : String ,
5246}
5347
5448#[ allow( dead_code) ]
55- #[ derive( Deserialize , Debug ) ]
49+ #[ derive( Deserialize , Debug , Default , Clone ) ]
5650#[ serde( rename_all = "camelCase" ) ]
5751pub struct ArtistContext {
52+ #[ serde( rename = "artistName" ) ]
5853 artist_name : String ,
59- artist_uri : String ,
54+ # [ serde ( rename = "imageUri" ) ]
6055 image_uri : String ,
56+ #[ serde( rename = "artistUri" ) ]
57+ artist_uri : String ,
6158}
6259
6360#[ allow( dead_code) ]
64- #[ derive( Deserialize , Debug ) ]
61+ #[ derive( Deserialize , Debug , Default , Clone ) ]
6562pub struct MetadataContext {
6663 album_title : String ,
6764 artist_name : String ,
6865 artist_uri : String ,
6966 image_url : String ,
7067 title : String ,
71- uid : String ,
68+ #[ serde( deserialize_with = "bool_from_string" ) ]
69+ is_explicit : bool ,
70+ #[ serde( deserialize_with = "bool_from_string" ) ]
71+ is_promotional : bool ,
72+ decision_id : String ,
73+ }
74+
75+ #[ allow( dead_code) ]
76+ #[ derive( Deserialize , Debug , Default , Clone ) ]
77+ pub struct SubtitleContext {
78+ name : String ,
79+ uri : String ,
80+ }
81+
82+ fn bool_from_string < ' de , D > ( de : D ) -> Result < bool , D :: Error >
83+ where
84+ D : serde:: Deserializer < ' de > ,
85+ {
86+ match String :: deserialize ( de) ?. as_ref ( ) {
87+ "true" => Ok ( true ) ,
88+ "false" => Ok ( false ) ,
89+ other => Err ( D :: Error :: invalid_value (
90+ Unexpected :: Str ( other) ,
91+ & "true or false" ,
92+ ) ) ,
93+ }
7294}
7395
7496#[ allow( non_snake_case) ]
0 commit comments