feat(api): add 7 label endpoints from v9.7.0.3 spec
Closes the gap between our client and the Qobuz Android app's current
label API (source: c30/b.java). Qobuz is rolling out a web beta so the
legacy /label/get is likely on borrowed time — adding the v9.7.0.3
endpoints now so the migration can happen in follow-up commits.
New endpoints (paths + client + core + bridge + v2 command + registered):
- /label/getAlbums → v2_get_label_albums
paginated catalog with sort/order/genre_ids/from_date/to_date
- /label/getNextReleases → v2_get_label_next_releases
- /label/getAwardedReleases → v2_get_label_awarded_releases
- /label/getPlaylists → v2_get_label_playlists
- /label/getTopArtists → v2_get_label_top_artists
- /label/story → v2_get_label_story
- /label/getList → v2_get_label_list (POST, mirrors
track/getList signing)
New response types in qbz-models:
- LabelListPage<T> — generic { has_more, items: [T], total?, offset?,
limit? } envelope, tolerant to either V2 list or SearchResultsPage
shapes until samples land
- LabelStoryResponse, LabelGetListResponse — best-effort with optional
fields so a shape mismatch is non-fatal
The legacy /label/get + get_label() + v2_get_label + LabelDetail are
retained untouched for now; frontend migration and deletion come next.
cc
This commit is contained in:
8 files changed
+685
-8
No files matched your search
@@ -68,9 +68,12 @@ pub use types::{
|
||||
Label,
|
||||
LabelDetail,
|
||||
LabelExploreResponse,
|
||||
LabelGetListResponse,
|
||||
LabelListPage,
|
||||
LabelPageContainer,
|
||||
LabelPageData,
|
||||
LabelPageGenericList,
|
||||
LabelStoryResponse,
|
||||
// Award types
|
||||
AlbumAward,
|
||||
AwardMagazine,
|
||||
|
||||
@@ -534,6 +534,68 @@ pub struct LabelExploreResponse {
|
||||
pub items: Option<Vec<serde_json::Value>>,
|
||||
}
|
||||
|
||||
// ============ Label Sub-resource Types (v9.7.0.3 API) ============
|
||||
//
|
||||
// The label page (/label/page) returns an aggregated snapshot; the
|
||||
// getAlbums / getPlaylists / getTopArtists / getNextReleases /
|
||||
// getAwardedReleases endpoints return paginated lists for each
|
||||
// sub-resource. Per Qobuz convention these use the V2 list envelope
|
||||
// { has_more, items: [...] }. Deserialized shapes are best-effort: if
|
||||
// the server wraps items in e.g. { albums: { items: ... } }, the
|
||||
// Optional fallbacks still keep the call non-fatal.
|
||||
|
||||
/// Generic paginated response from /label/get* endpoints.
|
||||
///
|
||||
/// `T` is typed (`Album`, `Playlist`, `Artist`) but all fields are
|
||||
/// tolerant so the same struct works if the server returns a bare
|
||||
/// items list or a nested one.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct LabelListPage<T> {
|
||||
#[serde(default)]
|
||||
pub has_more: Option<bool>,
|
||||
#[serde(default = "Vec::new")]
|
||||
pub items: Vec<T>,
|
||||
#[serde(default)]
|
||||
pub total: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub offset: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub limit: Option<u32>,
|
||||
}
|
||||
|
||||
/// Response from /label/story.
|
||||
///
|
||||
/// Shape inferred from `c30/b.java` — returns editorial / story content
|
||||
/// for a label. Actual fields beyond the label identity are not fully
|
||||
/// known; everything past `id` / `name` / `description` is kept open.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LabelStoryResponse {
|
||||
pub id: Option<u64>,
|
||||
pub name: Option<String>,
|
||||
#[serde(default)]
|
||||
pub description: Option<String>,
|
||||
#[serde(default)]
|
||||
pub story: Option<String>,
|
||||
#[serde(default)]
|
||||
pub image: Option<serde_json::Value>,
|
||||
#[serde(default)]
|
||||
pub has_more: Option<bool>,
|
||||
#[serde(default)]
|
||||
pub items: Option<Vec<serde_json::Value>>,
|
||||
}
|
||||
|
||||
/// Response from /label/getList (POST). Bulk lookup that hydrates
|
||||
/// label metadata for a set of label IDs.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct LabelGetListResponse {
|
||||
#[serde(default = "Vec::new")]
|
||||
pub labels: Vec<Label>,
|
||||
/// Fallback for unknown envelope shape — preserved as raw JSON if
|
||||
/// the server wraps differently than expected.
|
||||
#[serde(default)]
|
||||
pub extra: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
/// Genre model
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Genre {
|
||||
|
||||
Reference in new issue
Block a user