request

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: GPL-3.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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.

func (*Service) Create

func (s *Service) Create(
	ctx context.Context,
	mediaType string,
	mediaID uint32,
	title string,
	requesterID uint32,
) (*ent.Request, error)

func (*Service) Deny

func (s *Service) Deny(
	ctx context.Context,
	id, adminID uint32,
	reason string,
) (*ent.Request, error)

func (*Service) Get

func (s *Service) Get(ctx context.Context, id uint32) (*ent.Request, error)

func (*Service) List

func (s *Service) List(
	ctx context.Context,
	p db.ListRequestsParams,
) ([]*ent.Request, int, error)

func (*Service) Reopen

func (s *Service) Reopen(ctx context.Context, id uint32) (*ent.Request, error)

type ShowAdder

type ShowAdder interface {
	Add(
		ctx context.Context,
		tvdbID uint32,
		qualityProfile string,
	) (*ent.TVShow, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL