Documentation
¶
Overview ¶
Package transmission implements the Transmission adapter for the download capability.
Index ¶
- Constants
- func Register(app string, svc Service) error
- type Adapter
- func (a *Adapter) AddTorrent(ctx context.Context, in AddTorrentInput) (*capability.Torrent, error)
- func (a *Adapter) HealthCheck(ctx context.Context) (bool, error)
- func (a *Adapter) ListTorrents(ctx context.Context) ([]*capability.Torrent, error)
- func (a *Adapter) RemoveTorrents(ctx context.Context, in RemoveTorrentsInput) error
- func (a *Adapter) StopTorrents(ctx context.Context, in StopTorrentsInput) error
- type AddTorrentInput
- type RemoveTorrentsInput
- type Service
- type StopTorrentsInput
Constants ¶
const ( OpAdd = "add" OpList = "list" OpStop = "stop" OpRemove = "remove" OpHealth = "health" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements Service using the Transmission provider client.
func (*Adapter) AddTorrent ¶
func (a *Adapter) AddTorrent(ctx context.Context, in AddTorrentInput) (*capability.Torrent, error)
AddTorrent adds a torrent via magnet link or HTTP(S) .torrent URL.
func (*Adapter) HealthCheck ¶
HealthCheck reports whether the Transmission backend is reachable.
func (*Adapter) ListTorrents ¶
ListTorrents returns all torrents known to Transmission.
func (*Adapter) RemoveTorrents ¶
func (a *Adapter) RemoveTorrents(ctx context.Context, in RemoveTorrentsInput) error
RemoveTorrents removes one or more torrents by ID (data on disk is kept).
func (*Adapter) StopTorrents ¶
func (a *Adapter) StopTorrents(ctx context.Context, in StopTorrentsInput) error
StopTorrents stops one or more torrents by ID.
type AddTorrentInput ¶
type AddTorrentInput struct {
URL string
}
AddTorrentInput holds parameters for adding a torrent by URL or magnet link.
type RemoveTorrentsInput ¶
type RemoveTorrentsInput struct {
IDs []int64
}
RemoveTorrentsInput holds parameters for removing torrents by ID.
type Service ¶
type Service interface {
AddTorrent(ctx context.Context, in AddTorrentInput) (*capability.Torrent, error)
ListTorrents(ctx context.Context) ([]*capability.Torrent, error)
StopTorrents(ctx context.Context, in StopTorrentsInput) error
RemoveTorrents(ctx context.Context, in RemoveTorrentsInput) error
HealthCheck(ctx context.Context) (bool, error)
}
Service defines the transmission download capability contract.
func New ¶
func New() Service
New creates an Adapter using the default provider client (reads config from YAML). Returns nil when the provider is not configured.
func NewWithClient ¶
func NewWithClient(c client) Service
NewWithClient creates an Adapter with a specific client, useful for testing.
type StopTorrentsInput ¶
type StopTorrentsInput struct {
IDs []int64
}
StopTorrentsInput holds parameters for stopping torrents by ID.