Documentation
¶
Overview ¶
Package request is the media-request subsystem: users request movies/shows, admins approve (creating the monitored library item) or deny. It serves both verticals and is the purpose of the request_only role.
Index ¶
- Variables
- type Manager
- type MovieAdder
- type Service
- func (s *Service) Approve(ctx context.Context, id, adminID uint32, qualityProfile string) (*ent.Request, error)
- func (s *Service) Create(ctx context.Context, mediaType string, mediaID uint32, title string, ...) (*ent.Request, error)
- func (s *Service) Deny(ctx context.Context, id, adminID uint32, reason string) (*ent.Request, error)
- func (s *Service) Get(ctx context.Context, id uint32) (*ent.Request, error)
- func (s *Service) List(ctx context.Context, p db.ListRequestsParams) ([]*ent.Request, int, error)
- func (s *Service) Reopen(ctx context.Context, id uint32) (*ent.Request, error)
- type ShowAdder
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDuplicate is returned when the media is already requested (active) or // already in the library. ErrDuplicate = errors.New("request: already requested or in library") // ErrRequestNotFound is returned by Approve/Deny/Reopen for an unknown id // so callers can answer 404 instead of 500. ErrRequestNotFound = errors.New("request not found") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface {
Create(
ctx context.Context,
mediaType string,
mediaID uint32,
title string,
requesterID uint32,
) (*ent.Request, error)
Approve(
ctx context.Context,
id, adminID uint32,
qualityProfile string,
) (*ent.Request, error)
Get(ctx context.Context, id uint32) (*ent.Request, error)
Deny(
ctx context.Context,
id, adminID uint32,
reason string,
) (*ent.Request, error)
Reopen(ctx context.Context, id uint32) (*ent.Request, error)
List(
ctx context.Context,
p db.ListRequestsParams,
) ([]*ent.Request, int, error)
}
Manager is the request service surface consumed by REST handlers.
type MovieAdder ¶
type MovieAdder interface {
Add(
ctx context.Context,
tmdbID uint32,
qualityProfile string,
) (*ent.Movie, string, error)
GetByTMDBID(ctx context.Context, tmdbID uint32) (*ent.Movie, error)
}
MovieAdder / ShowAdder are the slices of the media services this needs — declared at the consumer so the request service depends only on what it uses.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(store db.Store, movies MovieAdder, shows ShowAdder) *Service
func (*Service) Approve ¶
func (s *Service) Approve( ctx context.Context, id, adminID uint32, qualityProfile string, ) (*ent.Request, error)
Approve adds the requested item to the library with qualityProfile (empty resolves to the server default) and marks the request approved.
Click to show internal directories.
Click to hide internal directories.