porla

package
v1.38.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTimeout = 60 * time.Second
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Name     string
	Hostname string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg Config) *Client

func (*Client) TorrentsAdd

func (c *Client) TorrentsAdd(ctx context.Context, req *TorrentsAddReq) error

func (*Client) TorrentsList

func (c *Client) TorrentsList(ctx context.Context, filters *TorrentsListFilters) (*TorrentsListRes, error)

func (*Client) Version

func (c *Client) Version() (*SysVersionsPorla, error)

type Config

type Config struct {
	Hostname  string
	AuthToken string

	// TLS skip cert validation
	TLSSkipVerify bool

	// HTTP Basic auth username
	BasicUser string

	// HTTP Basic auth password
	BasicPass string

	Timeout int
	Log     *log.Logger
}

type SysVersions

type SysVersions struct {
	Porla SysVersionsPorla `json:"porla"`
}

type SysVersionsPorla

type SysVersionsPorla struct {
	Commitish string `json:"commitish"`
	Version   string `json:"version"`
}

type Torrent

type Torrent struct {
	DownloadRate  int      `json:"download_rate"`
	UploadRate    int      `json:"upload_rate"`
	InfoHash      []string `json:"info_hash"`
	ListPeers     int      `json:"list_peers"`
	ListSeeds     int      `json:"list_seeds"`
	Name          string   `json:"name"`
	NumPeers      int      `json:"num_peers"`
	NumSeeds      int      `json:"num_seeds"`
	Progress      float64  `json:"progress"`
	QueuePosition int      `json:"queue_position"`
	SavePath      string   `json:"save_path"`
	Size          int      `json:"size"`
	Total         int      `json:"total"`
	TotalDone     int      `json:"total_done"`
}

type TorrentsAddReq

type TorrentsAddReq struct {
	DownloadLimit *int64  `json:"download_limit,omitempty"`
	SavePath      string  `json:"save_path,omitempty"`
	Ti            string  `json:"ti,omitempty"`
	MagnetUri     string  `json:"magnet_uri,omitempty"`
	UploadLimit   *int64  `json:"upload_limit,omitempty"`
	Preset        *string `json:"preset,omitempty"`
}

type TorrentsAddRes

type TorrentsAddRes struct {
}

type TorrentsListFilters

type TorrentsListFilters struct {
	Query string `json:"query"`
}

type TorrentsListReq

type TorrentsListReq struct {
	Filters *TorrentsListFilters `json:"filters"`
}

type TorrentsListRes

type TorrentsListRes struct {
	Page          int       `json:"page"`
	PageSize      int       `json:"page_size"`
	TorrentsTotal int       `json:"torrents_total"`
	Torrents      []Torrent `json:"torrents"`
}

Jump to

Keyboard shortcuts

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