79 lines
2.8 KiB
Go
79 lines
2.8 KiB
Go
// Package lidarr is a typed HTTP client for Lidarr's v1 API. It is the
|
|
// only place in the codebase that knows about Lidarr's wire format.
|
|
// Callers receive value structs, never raw JSON.
|
|
package lidarr
|
|
|
|
// LookupResult is the normalized shape returned by Lookup{Artist,Album,Track}.
|
|
// MBID is the kind's primary identifier (foreignArtistId / foreignAlbumId /
|
|
// foreignTrackId from Lidarr). ArtistMBID and AlbumMBID carry parent
|
|
// identifiers when the kind has them — request creation and admin
|
|
// approval need them to construct the lidarr_requests row and the
|
|
// AddArtist/AddAlbum API calls.
|
|
type LookupResult struct {
|
|
MBID string // foreignArtistId / foreignAlbumId / foreignTrackId
|
|
ArtistMBID string // parent artist's foreignArtistId — set on album/track results, empty on artist results
|
|
AlbumMBID string // parent album's foreignAlbumId — set on track results only
|
|
Name string // artist name; album/track returns Title here too
|
|
Secondary string // genre + album count for artist; year for album; album for track
|
|
ImageURL string // cover-art URL Lidarr surfaced (may be empty)
|
|
}
|
|
|
|
// lidarrImage is the wire shape for image entries in Lidarr's API responses.
|
|
type lidarrImage struct {
|
|
CoverType string `json:"coverType"`
|
|
RemoteURL string `json:"remoteUrl"`
|
|
URL string `json:"url"`
|
|
}
|
|
|
|
// QualityProfile is the dropdown choice in /admin/integrations.
|
|
type QualityProfile struct {
|
|
ID int
|
|
Name string
|
|
}
|
|
|
|
// RootFolder is the dropdown choice in /admin/integrations.
|
|
type RootFolder struct {
|
|
Path string
|
|
Accessible bool
|
|
FreeSpace int64
|
|
}
|
|
|
|
// AddArtistParams are the fields Lidarr requires on POST /api/v1/artist.
|
|
type AddArtistParams struct {
|
|
ForeignArtistID string
|
|
QualityProfileID int
|
|
RootFolderPath string
|
|
MonitorAll bool // true => monitor="all"; false => "future"
|
|
}
|
|
|
|
// AddAlbumParams are the fields Lidarr requires on POST /api/v1/album.
|
|
type AddAlbumParams struct {
|
|
ForeignAlbumID string
|
|
ForeignArtistID string // Lidarr requires the artist's foreign id too
|
|
QualityProfileID int
|
|
RootFolderPath string
|
|
}
|
|
|
|
// PingResult is the response shape from GET /api/v1/system/status.
|
|
type PingResult struct {
|
|
Version string
|
|
}
|
|
|
|
// LidarrArtist is the subset of Lidarr's artist resource used by M5b
|
|
// admin actions. The "id" field is Lidarr's internal numeric ID — needed
|
|
// for DELETE /api/v1/artist/{id} calls.
|
|
type LidarrArtist struct {
|
|
ID int `json:"id"`
|
|
ForeignArtistID string `json:"foreignArtistId"` // MBID
|
|
ArtistName string `json:"artistName"`
|
|
}
|
|
|
|
// LidarrAlbum is the subset of Lidarr's album resource used by M5b
|
|
// admin actions.
|
|
type LidarrAlbum struct {
|
|
ID int `json:"id"`
|
|
ForeignAlbumID string `json:"foreignAlbumId"` // MBID
|
|
Title string `json:"title"`
|
|
ArtistID int `json:"artistId"`
|
|
}
|