apis

package
v0.4.17 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugMode bool
	MuteMode  bool
)

Functions

func AddHeaders

func AddHeaders(req *http.Request)

func Download

func Download(link string, backend BaseBackend)

func DownloadFile

func DownloadFile(config DownConfig) error

func InitCmd

func InitCmd(cmd *cobra.Command)

func Upload

func Upload(files []string, backend BaseBackend)

Types

type Backend

type Backend struct {
	BaseBackend
	Bar *pb.ProgressBar
}

func (Backend) DoDownload

func (b Backend) DoDownload(link string, config DownConfig) error

func (Backend) DoUpload

func (b Backend) DoUpload(string, int64, io.Reader) error

func (Backend) EndProgress

func (b Backend) EndProgress()

func (Backend) FinishUpload

func (b Backend) FinishUpload([]string) (string, error)

func (Backend) InitUpload

func (b Backend) InitUpload([]string, []int64) error

func (Backend) PostUpload

func (b Backend) PostUpload(string, int64) (string, error)

func (Backend) PreUpload

func (b Backend) PreUpload(string, int64) error

func (*Backend) StartProgress

func (b *Backend) StartProgress(stream io.Reader, size int64) io.Reader

type BaseBackend

type BaseBackend interface {
	Uploader
	Downloader
	SetArgs(*cobra.Command)
	LinkMatcher(string) bool
}

type DownConfig

type DownConfig struct {
	methods.DownloaderConfig
	Ticket string
}
var (
	DownloadConfig DownConfig
)

type Downloader

type Downloader interface {
	DoDownload(string, DownConfig) error
}

type Uploader

type Uploader interface {
	InitUpload([]string, []int64) error
	PreUpload(string, int64) error
	DoUpload(string, int64, io.Reader) error
	PostUpload(string, int64) (string, error)
	FinishUpload([]string) (string, error)

	StartProgress(io.Reader, int64) io.Reader
	EndProgress()
}

Jump to

Keyboard shortcuts

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