- Created `client.go` for the main client structure and methods to interact with *arr services. - Added `types.go` to define data structures for system status, movies, and series. - Implemented `radarr.go` for Radarr-specific client methods including health checks and movie retrieval. - Introduced `interfaces.go` to define service interfaces for common operations across *arr services. - Established a basic `main.go` for application entry point. - Included a tutorial markdown file to guide users through building the client and understanding Go concepts. - Initialized `go.mod` for module management. - Organized code into appropriate packages for better structure and maintainability.
31 lines
827 B
Go
31 lines
827 B
Go
package main
|
|
|
|
// ServiceClient defines the interface all *arr services must implement
|
|
type ServiceClient interface {
|
|
GetSystemStatus() (*SystemStatus, error)
|
|
GetHealth() ([]HealthCheck, error)
|
|
}
|
|
|
|
// MovieService defines movie-specific operations (Radarr)
|
|
type MovieService interface {
|
|
ServiceClient
|
|
GetMovies() ([]Movie, error)
|
|
GetMovie(id int) (*Movie, error)
|
|
AddMovie(movie *Movie) (*Movie, error)
|
|
}
|
|
|
|
// SeriesService defines series-specific operations (Sonarr)
|
|
type SeriesService interface {
|
|
ServiceClient
|
|
GetSeries() ([]Series, error)
|
|
GetSeriesById(id int) (*Series, error)
|
|
AddSeries(series *Series) (*Series, error)
|
|
}
|
|
|
|
// HealthCheck is the struct that represents the health check result.
|
|
type HealthCheck struct {
|
|
Source string `json:"source"`
|
|
Type string `json:"type"`
|
|
Message string `json:"message"`
|
|
}
|