qobuz_api_rust/models/
article.rs

1use serde::{Deserialize, Serialize};
2
3use crate::models::Author as AuthorModel;
4
5/// Article model containing information about an article
6///
7/// This struct represents an article with its identification, title, description,
8/// authors, and various metadata.
9///
10/// # Examples
11///
12/// ```
13/// use qobuz_api_rust::models::Article;
14///
15/// let article = Article {
16///     id: Some("article123".to_string()),
17///     title: Some("Music Review".to_string()),
18///     ..Default::default()
19/// };
20/// ```
21#[derive(Serialize, Deserialize, Debug, Clone, Default)]
22pub struct Article {
23    /// Unique identifier for the article
24    #[serde(rename = "id")]
25    pub id: Option<String>,
26
27    /// Title of the article
28    #[serde(rename = "title")]
29    pub title: Option<String>,
30
31    /// Full description of the article
32    #[serde(rename = "description")]
33    pub description: Option<String>,
34
35    /// Short description of the article
36    #[serde(rename = "description_short")]
37    pub description_short: Option<String>,
38
39    /// URL to the article
40    #[serde(rename = "url")]
41    pub url: Option<String>,
42
43    /// URL to the article's main image
44    #[serde(rename = "image")]
45    pub image: Option<String>,
46
47    /// URL to the article's rectangular image
48    #[serde(rename = "image_rectangle")]
49    pub image_rectangle: Option<String>,
50
51    /// List of authors who wrote the article
52    #[serde(rename = "authors")]
53    pub authors: Option<Vec<AuthorModel>>,
54
55    /// Display date for the article
56    #[serde(rename = "display_date")]
57    pub display_date: Option<String>,
58
59    /// List of section slugs the article belongs to
60    #[serde(rename = "section_slugs")]
61    pub section_slugs: Option<Vec<String>>,
62
63    /// List of tags associated with the article
64    #[serde(rename = "tags")]
65    pub tags: Option<Vec<String>>,
66
67    /// URL-friendly slug for the article
68    #[serde(rename = "slug")]
69    pub slug: Option<String>,
70
71    /// Unix timestamp of when the article was created
72    #[serde(rename = "created_at")]
73    pub created_at: Option<i64>,
74
75    /// Unix timestamp of when the article was last updated
76    #[serde(rename = "updated_at")]
77    pub updated_at: Option<i64>,
78}
79
80/// Author model containing information about an author
81///
82/// This struct represents an author with their identification, name, slug, and image.
83///
84/// # Examples
85///
86/// ```
87/// use qobuz_api_rust::models::Author;
88///
89/// let author = Author {
90///     id: Some("author123".to_string()),
91///     name: Some("John Doe".to_string()),
92///     slug: Some("john-doe".to_string()),
93///     ..Default::default()
94/// };
95/// ```
96#[derive(Serialize, Deserialize, Debug, Clone, Default)]
97pub struct Author {
98    /// Unique identifier for the author
99    #[serde(rename = "id")]
100    pub id: Option<String>,
101
102    /// Name of the author
103    #[serde(rename = "name")]
104    pub name: Option<String>,
105
106    /// URL-friendly slug for the author
107    #[serde(rename = "slug")]
108    pub slug: Option<String>,
109
110    /// URL to the author's image
111    #[serde(rename = "image")]
112    pub image: Option<String>,
113}
114
115/// Story model containing information about a story or article
116///
117/// This struct represents a story or article with its identification, title,
118/// description, authors, and various metadata.
119///
120/// # Examples
121///
122/// ```
123/// use qobuz_api_rust::models::Story;
124///
125/// let story = Story {
126///     id: Some("story123".to_string()),
127///     title: Some("Music Story".to_string()),
128///     display_date: Some(1672531200), // Unix timestamp
129///     ..Default::default()
130/// };
131/// ```
132#[derive(Serialize, Deserialize, Debug, Clone, Default)]
133pub struct Story {
134    /// Unique identifier for the story
135    #[serde(rename = "id")]
136    pub id: Option<String>,
137
138    /// List of section slugs the story belongs to
139    #[serde(rename = "section_slugs")]
140    pub section_slugs: Option<Vec<String>>,
141
142    /// Title of the story
143    #[serde(rename = "title")]
144    pub title: Option<String>,
145
146    /// Short description of the story
147    #[serde(rename = "description_short")]
148    pub description_short: Option<String>,
149
150    /// List of authors who wrote the story
151    #[serde(rename = "authors")]
152    pub authors: Option<Vec<Author>>,
153
154    /// URL to the story's main image
155    #[serde(rename = "image")]
156    pub image: Option<String>,
157
158    /// Display date for the story as a Unix timestamp
159    #[serde(rename = "display_date")]
160    pub display_date: Option<i64>,
161}
162
163/// Biography model containing information about an artist's biography
164///
165/// This struct represents an artist's biography with content, summary, and source information.
166///
167/// # Examples
168///
169/// ```
170/// use qobuz_api_rust::models::Biography;
171///
172/// let biography = Biography {
173///     content: Some("Full biography content...".to_string()),
174///     summary: Some("Brief summary...".to_string()),
175///     source: Some("Official biography".to_string()),
176/// };
177/// ```
178#[derive(Serialize, Deserialize, Debug, Clone, Default)]
179pub struct Biography {
180    /// Full content of the biography
181    #[serde(rename = "content")]
182    pub content: Option<String>,
183
184    /// Summary of the biography
185    #[serde(rename = "summary")]
186    pub summary: Option<String>,
187
188    /// Source of the biography information
189    #[serde(rename = "source")]
190    pub source: Option<String>,
191}