request

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAllowFTP

func WithAllowFTP(req *Request)

func WithAllowLocal

func WithAllowLocal(req *Request)

func WithAllowS3

func WithAllowS3(req *Request)

func WithAuth

func WithAuth(secret tl.Secret, auth tl.FeedAuthorization) func(req *Request)

Types

type Az added in v0.12.0

type Az struct {
	Account   string
	Container string
	KeyPrefix string
}

func NewAzFromUrl added in v0.12.0

func NewAzFromUrl(ustr string) (*Az, error)

func (Az) CreateSignedUrl added in v0.12.0

func (r Az) CreateSignedUrl(ctx context.Context, key string, secret tl.Secret) (string, error)

func (Az) Download added in v0.12.0

func (r Az) Download(ctx context.Context, key string, secret tl.Secret, auth tl.FeedAuthorization) (io.ReadCloser, int, error)

func (Az) Upload added in v0.12.0

func (r Az) Upload(ctx context.Context, key string, secret tl.Secret, uploadFile io.Reader) error

type Downloader added in v0.12.0

type Downloader interface {
	Download(context.Context, string, tl.Secret, tl.FeedAuthorization) (io.ReadCloser, int, error)
}

type FetchResponse added in v0.10.2

type FetchResponse struct {
	Filename     string
	Data         []byte
	ResponseSize int
	ResponseCode int
	ResponseSHA1 string
	FetchError   error
}

func AuthenticatedRequest

func AuthenticatedRequest(address string, opts ...RequestOption) (FetchResponse, error)

AuthenticatedRequest fetches a url using a secret and auth description. Returns []byte, sha1, size, response code.

func AuthenticatedRequestDownload

func AuthenticatedRequestDownload(address string, opts ...RequestOption) (FetchResponse, error)

AuthenticatedRequestDownload is similar to AuthenticatedRequest but writes to a temporary file.

type Ftp added in v0.12.0

type Ftp struct{}

func (Ftp) Download added in v0.12.0

func (Ftp) Download(ctx context.Context, ustr string, secret tl.Secret, auth tl.FeedAuthorization) (io.ReadCloser, int, error)

type Http added in v0.12.0

type Http struct{}

func (Http) Download added in v0.12.0

func (r Http) Download(ctx context.Context, ustr string, secret tl.Secret, auth tl.FeedAuthorization) (io.ReadCloser, int, error)

type Local added in v0.12.0

type Local struct {
	Directory string
}

func (Local) Download added in v0.12.0

func (r Local) Download(ctx context.Context, ustr string, secret tl.Secret, auth tl.FeedAuthorization) (io.ReadCloser, int, error)

func (Local) Exists added in v0.13.0

func (r Local) Exists(ctx context.Context, key string) bool

func (Local) Upload added in v0.12.0

func (r Local) Upload(ctx context.Context, key string, secret tl.Secret, uploadFile io.Reader) error

type Presigner added in v0.12.0

type Presigner interface {
	CreateSignedUrl(context.Context, string, tl.Secret) (string, error)
}

type Request

type Request struct {
	URL        string
	AllowFTP   bool
	AllowLocal bool
	AllowS3    bool
	MaxSize    uint64
	Secret     tl.Secret
	Auth       tl.FeedAuthorization
}

func NewRequest

func NewRequest(address string, opts ...RequestOption) *Request

func (*Request) Request

func (req *Request) Request(ctx context.Context) (io.ReadCloser, int, error)

type RequestOption

type RequestOption func(*Request)

func WithMaxSize added in v0.14.0

func WithMaxSize(s uint64) RequestOption

type S3 added in v0.12.0

type S3 struct {
	Bucket    string
	KeyPrefix string
}

func NewS3FromUrl added in v0.12.0

func NewS3FromUrl(ustr string) (*S3, error)

func (S3) CreateSignedUrl added in v0.12.0

func (r S3) CreateSignedUrl(ctx context.Context, key string, secret tl.Secret) (string, error)

func (S3) Download added in v0.12.0

func (r S3) Download(ctx context.Context, key string, secret tl.Secret, auth tl.FeedAuthorization) (io.ReadCloser, int, error)

func (S3) Upload added in v0.12.0

func (r S3) Upload(ctx context.Context, key string, secret tl.Secret, uploadFile io.Reader) error

type Uploader added in v0.12.0

type Uploader interface {
	Upload(context.Context, string, tl.Secret, io.Reader) error
}

Jump to

Keyboard shortcuts

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