transmission

package
v0.97.8 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package transmission implements the Transmission adapter for the download capability.

Index

Constants

View Source
const (
	OpAdd    = "add"
	OpList   = "list"
	OpStop   = "stop"
	OpRemove = "remove"
	OpHealth = "health"
)

Variables

This section is empty.

Functions

func Register

func Register(app string, svc Service) error

Register registers the transmission capability with hub and invoker registry. When svc is nil the provider is not configured and registration is skipped.

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

func (a *Adapter) HealthCheck(ctx context.Context) (bool, error)

HealthCheck reports whether the Transmission backend is reachable.

func (*Adapter) ListTorrents

func (a *Adapter) ListTorrents(ctx context.Context) ([]*capability.Torrent, error)

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.

Jump to

Keyboard shortcuts

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