download

package
v0.0.0-...-5f25c38 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptContentType

type AcceptContentType string
const (
	AcceptBinary     AcceptContentType = "application/octet-stream"
	AcceptGitHubJSON AcceptContentType = "application/vnd.github+json"
	AcceptText       AcceptContentType = "text/plain"
)

type Client

type Client struct {
	Headers    []string
	Token      string
	Accept     string
	DisableSSL bool

	CreateClient func() *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token string) *Client

func (*Client) AddHeader

func (dc *Client) AddHeader(header string, value string) *Client

func (*Client) Download

func (dc *Client) Download(url string, out io.Writer, progressBarCallback func(size int64) *pb.ProgressBar) error

func (*Client) Get

func (dc *Client) Get(url string) (*http.Response, error)

func (*Client) GetBinaryFile

func (dc *Client) GetBinaryFile(url string) (*http.Response, error)

func (*Client) GetClient

func (dc *Client) GetClient() *http.Client

func (*Client) GetJSON

func (dc *Client) GetJSON(url string) (*http.Response, error)

func (*Client) GetText

func (dc *Client) GetText(url string) (*http.Response, error)

func (*Client) GetTokenType

func (dc *Client) GetTokenType() string

func (*Client) SetAccept

func (dc *Client) SetAccept(accept AcceptContentType) *Client

func (*Client) SetDisableSSL

func (dc *Client) SetDisableSSL(disableSSL bool) *Client

func (*Client) SetHeaders

func (dc *Client) SetHeaders(headers []string) *Client

func (*Client) SetToken

func (dc *Client) SetToken(token string) *Client

func (*Client) SetTokenType

func (dc *Client) SetTokenType(tokenType string) *Client

type ClientContract

type ClientContract interface {
	GetClient() *http.Client
	Get(url string) (*http.Response, error)
	GetJSON(url string) (*http.Response, error)
	GetBinaryFile(url string) (*http.Response, error)
	GetText(url string) (*http.Response, error)
	Download(url string, out io.Writer, progressBarCallback func(size int64) *pb.ProgressBar) error
}

Jump to

Keyboard shortcuts

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