39 lines
756 B
Go
39 lines
756 B
Go
package domain
|
|
|
|
type RadarrEventType string
|
|
|
|
const (
|
|
RadarrEventTypeDownload RadarrEventType = "Download"
|
|
RadarrEventTypeTest RadarrEventType = "Test"
|
|
)
|
|
|
|
var (
|
|
ErrUnsupportedRadarrEventType = NewError(WithCode(ErrorCodeValidation), WithMessage("unsupported event type"))
|
|
)
|
|
|
|
func NewRadarrEventType(s string) (RadarrEventType, error) {
|
|
conv := RadarrEventType(s)
|
|
switch conv {
|
|
case RadarrEventTypeDownload,
|
|
RadarrEventTypeTest:
|
|
return conv, nil
|
|
default:
|
|
return "", ErrUnsupportedSonarrEventType
|
|
}
|
|
}
|
|
|
|
func (r RadarrEventType) String() string {
|
|
return string(r)
|
|
}
|
|
|
|
type RadarrMovie struct {
|
|
ID int64
|
|
Title string
|
|
ReleaseDate string
|
|
}
|
|
|
|
type RadarrWebhookPayload struct {
|
|
EventType RadarrEventType
|
|
Movie RadarrMovie
|
|
}
|