Add Radarr client (M1)

Shared arr HTTP client with API error handling, plus Radarr lookup,
add movie, search and quality profile / root folder / status endpoints.
Tested against httptest fixtures.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 17:39:02 +02:00
co-authored by Claude Sonnet 5.5
parent 9f05523c02
commit 2c821fd098
5 changed files with 472 additions and 2 deletions
+54
View File
@@ -0,0 +1,54 @@
package arr
import (
"context"
"net/http"
)
// SystemStatus is the subset of /system/status we use.
type SystemStatus struct {
AppName string `json:"appName"`
Version string `json:"version"`
}
// QualityProfile is a Radarr/Sonarr quality profile.
type QualityProfile struct {
ID int `json:"id"`
Name string `json:"name"`
}
// RootFolder is a configured library root.
type RootFolder struct {
ID int `json:"id"`
Path string `json:"path"`
FreeSpace int64 `json:"freeSpace"`
Accessible bool `json:"accessible"`
}
// Image is a poster/fanart reference.
type Image struct {
CoverType string `json:"coverType"`
URL string `json:"url,omitempty"`
RemoteURL string `json:"remoteUrl,omitempty"`
}
// SystemStatus fetches /system/status.
func (c *Client) SystemStatus(ctx context.Context) (SystemStatus, error) {
var s SystemStatus
err := c.Do(ctx, http.MethodGet, "system/status", nil, nil, &s)
return s, err
}
// QualityProfiles lists quality profiles.
func (c *Client) QualityProfiles(ctx context.Context) ([]QualityProfile, error) {
var p []QualityProfile
err := c.Do(ctx, http.MethodGet, "qualityprofile", nil, nil, &p)
return p, err
}
// RootFolders lists root folders.
func (c *Client) RootFolders(ctx context.Context) ([]RootFolder, error) {
var f []RootFolder
err := c.Do(ctx, http.MethodGet, "rootfolder", nil, nil, &f)
return f, err
}