plik

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Upload(name string, r io.Reader, opts ...Option) (string, error)
}

A Client defines all interactions that can be performed on a Plik server.

func New

func New(c *http.Client, endpoint string) (Client, error)

New returns a new Client.

func NewDefault

func NewDefault(endpoint string) (Client, error)

NewDefault returns a new Client with default HTTP client.

type Option

type Option func(*Options)

Option is a function used in the Functional Options pattern.

func BasicAuth

func BasicAuth(login, password string) Option

BasicAuth protects upload with HTTP basic auth.

func Header(header url.Values) Option

Header sets the headers for each requests.

func OneShot

func OneShot() Option

OneShot removes the remote file after the first download.

func OneShotFrom

func OneShotFrom(b bool) Option

OneShotFrom removes the remote file after the first download.

func TTL

func TTL(ttl time.Duration) Option

TTL is the time before removing remote file.

func UserAgent added in v0.1.1

func UserAgent(name string) Option

UserAgent sets the User-Agent for each requests.

type Options

type Options struct {
	ID       string `json:"id"`
	Creation int64  `json:"uploadDate"`
	TTL      int    `json:"ttl"`

	UploadToken string `json:"uploadToken,omitempty"`
	User        string `json:"user,omitempty"`
	Token       string `json:"token,omitempty"`
	IsAdmin     bool   `json:"admin"`

	Stream    bool `json:"stream"`
	OneShot   bool `json:"oneShot"`
	Removable bool `json:"removable"`

	ProtectedByPassword bool   `json:"protectedByPassword"`
	Login               string `json:"login,omitempty"`
	Password            string `json:"password,omitempty"`
	// contains filtered or unexported fields
}

Options contains upload characteristics.

Jump to

Keyboard shortcuts

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