qobuz_api_rust/models/
subscription.rs

1use serde::{Deserialize, Serialize};
2
3/// Last update model containing timestamps for various user data
4///
5/// This struct represents the last update times for different types of user data
6/// such as favorites, playlists, and other collections.
7///
8/// # Examples
9///
10/// ```
11/// use qobuz_api_rust::models::LastUpdate;
12///
13/// let last_update = LastUpdate {
14///     favorites: Some("2023-01-01T00:00:00Z".to_string()),
15///     playlists: Some("2023-01-02T00:00:00Z".to_string()),
16///     ..Default::default()
17/// };
18/// ```
19#[derive(Serialize, Deserialize, Debug, Clone, Default)]
20pub struct LastUpdate {
21    /// Last update time for favorites
22    #[serde(rename = "favorites")]
23    pub favorites: Option<String>,
24
25    /// Last update time for playlists
26    #[serde(rename = "playlists")]
27    pub playlists: Option<String>,
28
29    /// Last update time for followings
30    #[serde(rename = "followings")]
31    pub followings: Option<String>,
32
33    /// Last update time for subscriptions
34    #[serde(rename = "subscriptions")]
35    pub subscriptions: Option<String>,
36
37    /// Last update time for purchases
38    #[serde(rename = "purchases")]
39    pub purchases: Option<String>,
40
41    /// Last update time for playback history
42    #[serde(rename = "playback_history")]
43    pub playback_history: Option<String>,
44
45    /// Last update time for the user's library
46    #[serde(rename = "library")]
47    pub library: Option<String>,
48
49    /// Last update time for recommendations
50    #[serde(rename = "recommendations")]
51    pub recommendations: Option<String>,
52
53    /// Last update time for discover content
54    #[serde(rename = "discover")]
55    pub discover: Option<String>,
56
57    /// Last update time for personal radio
58    #[serde(rename = "personal_radio")]
59    pub personal_radio: Option<String>,
60
61    /// Last update time for instant mixes
62    #[serde(rename = "instant_mixes")]
63    pub instant_mixes: Option<String>,
64
65    /// Last update time for smart playlists
66    #[serde(rename = "smart_playlists")]
67    pub smart_playlists: Option<String>,
68
69    /// Last update time for daily mixes
70    #[serde(rename = "daily_mixes")]
71    pub daily_mixes: Option<String>,
72
73    /// Last update time for weekly mixes
74    #[serde(rename = "weekly_mixes")]
75    pub weekly_mixes: Option<String>,
76
77    /// Last update time for monthly mixes
78    #[serde(rename = "monthly_mixes")]
79    pub monthly_mixes: Option<String>,
80
81    /// Last update time for yearly mixes
82    #[serde(rename = "yearly_mixes")]
83    pub yearly_mixes: Option<String>,
84}
85
86/// Store features model containing information about available features
87///
88/// This struct represents the features available in the Qobuz store for a user
89/// including free tier, trial, subscription, and various content types.
90///
91/// # Examples
92///
93/// ```
94/// use qobuz_api_rust::models::StoreFeatures;
95///
96/// let store_features = StoreFeatures {
97///     has_free_tier: Some(true),
98///     has_subscription: Some(true),
99///     has_download: Some(true),
100///     ..Default::default()
101/// };
102/// ```
103#[derive(Serialize, Deserialize, Debug, Clone, Default)]
104pub struct StoreFeatures {
105    /// Whether the store has a free tier
106    #[serde(rename = "has_free_tier")]
107    pub has_free_tier: Option<bool>,
108
109    /// Whether the store has a trial option
110    #[serde(rename = "has_trial")]
111    pub has_trial: Option<bool>,
112
113    /// Whether the store has a subscription option
114    #[serde(rename = "has_subscription")]
115    pub has_subscription: Option<bool>,
116
117    /// Whether the store offers high-resolution content
118    #[serde(rename = "has_hires")]
119    pub has_hires: Option<bool>,
120
121    /// Whether the store allows downloading
122    #[serde(rename = "has_download")]
123    pub has_download: Option<bool>,
124
125    /// Whether the store allows streaming
126    #[serde(rename = "has_streaming")]
127    pub has_streaming: Option<bool>,
128
129    /// Whether the store has radio functionality
130    #[serde(rename = "has_radio")]
131    pub has_radio: Option<bool>,
132
133    /// Whether the store has playlist functionality
134    #[serde(rename = "has_playlist")]
135    pub has_playlist: Option<bool>,
136
137    /// Whether the store has favorites functionality
138    #[serde(rename = "has_favorites")]
139    pub has_favorites: Option<bool>,
140
141    /// Whether the store has a library functionality
142    #[serde(rename = "has_library")]
143    pub has_library: Option<bool>,
144
145    /// Whether the store has discovery features
146    #[serde(rename = "has_discover")]
147    pub has_discover: Option<bool>,
148
149    /// Whether the store has recommendation features
150    #[serde(rename = "has_recommendations")]
151    pub has_recommendations: Option<bool>,
152
153    /// Whether the store has personal radio features
154    #[serde(rename = "has_personal_radio")]
155    pub has_personal_radio: Option<bool>,
156
157    /// Whether the store has instant mixes
158    #[serde(rename = "has_instant_mixes")]
159    pub has_instant_mixes: Option<bool>,
160
161    /// Whether the store has smart playlists
162    #[serde(rename = "has_smart_playlists")]
163    pub has_smart_playlists: Option<bool>,
164
165    /// Whether the store has daily mixes
166    #[serde(rename = "has_daily_mixes")]
167    pub has_daily_mixes: Option<bool>,
168
169    /// Whether the store has weekly mixes
170    #[serde(rename = "has_weekly_mixes")]
171    pub has_weekly_mixes: Option<bool>,
172
173    /// Whether the store has monthly mixes
174    #[serde(rename = "has_monthly_mixes")]
175    pub has_monthly_mixes: Option<bool>,
176
177    /// Whether the store has yearly mixes
178    #[serde(rename = "has_yearly_mixes")]
179    pub has_yearly_mixes: Option<bool>,
180}
181
182/// Subscription model containing user subscription information
183///
184/// This struct represents a user's subscription details including plan information,
185/// status, dates, and payment information.
186///
187/// # Examples
188///
189/// ```
190/// use qobuz_api_rust::models::Subscription;
191///
192/// let subscription = Subscription {
193///     id: Some("sub123".to_string()),
194///     status: Some("active".to_string()),
195///     is_active: Some(true),
196///     ..Default::default()
197/// };
198/// ```
199#[derive(Serialize, Deserialize, Debug, Clone, Default)]
200pub struct Subscription {
201    /// Unique identifier for the subscription
202    #[serde(rename = "id")]
203    pub id: Option<String>,
204
205    /// User ID associated with the subscription
206    #[serde(rename = "user_id")]
207    pub user_id: Option<i64>,
208
209    /// Offer ID for the subscription plan
210    #[serde(rename = "offer_id")]
211    pub offer_id: Option<String>,
212
213    /// Name of the subscription offer
214    #[serde(rename = "offer_name")]
215    pub offer_name: Option<String>,
216
217    /// Country where the offer is available
218    #[serde(rename = "offer_country")]
219    pub offer_country: Option<String>,
220
221    /// Currency used for the subscription
222    #[serde(rename = "offer_currency")]
223    pub offer_currency: Option<String>,
224
225    /// Price of the subscription offer
226    #[serde(rename = "offer_price")]
227    pub offer_price: Option<f64>,
228
229    /// Number of trial days included in the offer
230    #[serde(rename = "offer_trial_days")]
231    pub offer_trial_days: Option<i32>,
232
233    /// Type of the subscription offer
234    #[serde(rename = "offer_type")]
235    pub offer_type: Option<String>,
236
237    /// Family of the subscription offer
238    #[serde(rename = "offer_family")]
239    pub offer_family: Option<String>,
240
241    /// List of features included in the offer
242    #[serde(rename = "offer_features")]
243    pub offer_features: Option<Vec<String>>,
244
245    /// Current status of the subscription
246    #[serde(rename = "status")]
247    pub status: Option<String>,
248
249    /// Status code for the subscription
250    #[serde(rename = "status_code")]
251    pub status_code: Option<String>,
252
253    /// Start date of the subscription
254    #[serde(rename = "start_date")]
255    pub start_date: Option<String>,
256
257    /// End date of the subscription
258    #[serde(rename = "end_date")]
259    pub end_date: Option<String>,
260
261    /// Date when the subscription will renew
262    #[serde(rename = "renew_date")]
263    pub renew_date: Option<String>,
264
265    /// Date when the subscription was canceled
266    #[serde(rename = "cancel_date")]
267    pub cancel_date: Option<String>,
268
269    /// Reason for cancellation
270    #[serde(rename = "cancel_reason")]
271    pub cancel_reason: Option<String>,
272
273    /// Whether the subscription is currently active
274    #[serde(rename = "is_active")]
275    pub is_active: Option<bool>,
276
277    /// Whether the subscription is currently in trial
278    #[serde(rename = "is_trial")]
279    pub is_trial: Option<bool>,
280
281    /// Whether the subscription has been canceled
282    #[serde(rename = "is_canceled")]
283    pub is_canceled: Option<bool>,
284
285    /// Whether the subscription has expired
286    #[serde(rename = "is_expired")]
287    pub is_expired: Option<bool>,
288
289    /// Whether the subscription can be renewed
290    #[serde(rename = "is_renewable")]
291    pub is_renewable: Option<bool>,
292
293    /// Whether the subscription has auto-renewal enabled
294    #[serde(rename = "is_auto_renew")]
295    pub is_auto_renew: Option<bool>,
296
297    /// Date of the next payment
298    #[serde(rename = "next_payment_date")]
299    pub next_payment_date: Option<String>,
300
301    /// Date of the last payment
302    #[serde(rename = "last_payment_date")]
303    pub last_payment_date: Option<String>,
304
305    /// Amount of the next payment
306    #[serde(rename = "next_payment_amount")]
307    pub next_payment_amount: Option<f64>,
308
309    /// Payment method used for the subscription
310    #[serde(rename = "payment_method")]
311    pub payment_method: Option<String>,
312
313    /// Status of the payment
314    #[serde(rename = "payment_status")]
315    pub payment_status: Option<String>,
316
317    /// Number of failed payment attempts
318    #[serde(rename = "payment_failed_count")]
319    pub payment_failed_count: Option<i32>,
320
321    /// Reason for payment failure
322    #[serde(rename = "payment_failed_reason")]
323    pub payment_failed_reason: Option<String>,
324
325    /// Date of the payment failure
326    #[serde(rename = "payment_failed_date")]
327    pub payment_failed_date: Option<String>,
328
329    /// Date for the next payment retry
330    #[serde(rename = "payment_retry_date")]
331    pub payment_retry_date: Option<String>,
332
333    /// Number of payment retry attempts made
334    #[serde(rename = "payment_retry_count")]
335    pub payment_retry_count: Option<i32>,
336
337    /// Maximum number of payment retry attempts allowed
338    #[serde(rename = "payment_retry_max")]
339    pub payment_retry_max: Option<i32>,
340
341    /// Interval between payment retry attempts
342    #[serde(rename = "payment_retry_interval")]
343    pub payment_retry_interval: Option<i32>,
344
345    /// Multiplier for payment retry intervals
346    #[serde(rename = "payment_retry_multiplier")]
347    pub payment_retry_multiplier: Option<f64>,
348
349    /// Backoff strategy for payment retries
350    #[serde(rename = "payment_retry_backoff")]
351    pub payment_retry_backoff: Option<String>,
352
353    /// Strategy for payment retries
354    #[serde(rename = "payment_retry_strategy")]
355    pub payment_retry_strategy: Option<String>,
356
357    /// Whether payment retry is enabled
358    #[serde(rename = "payment_retry_enabled")]
359    pub payment_retry_enabled: Option<bool>,
360
361    /// Whether payment retry is currently active
362    #[serde(rename = "payment_retry_active")]
363    pub payment_retry_active: Option<bool>,
364
365    /// Whether payment retry is scheduled
366    #[serde(rename = "payment_retry_scheduled")]
367    pub payment_retry_scheduled: Option<bool>,
368
369    /// Date when payment retry is scheduled
370    #[serde(rename = "payment_retry_scheduled_date")]
371    pub payment_retry_scheduled_date: Option<String>,
372
373    /// Number of scheduled payment retry attempts
374    #[serde(rename = "payment_retry_scheduled_count")]
375    pub payment_retry_scheduled_count: Option<i32>,
376
377    /// Reason for scheduled payment retry
378    #[serde(rename = "payment_retry_scheduled_reason")]
379    pub payment_retry_scheduled_reason: Option<String>,
380}