Documentation ¶
Index ¶
- type ConcurrentDownloadFlags
- type ConnectHandler
- type DownloadFileDetails
- type ErrorHandler
- type HttpClient
- func (jc *HttpClient) DownloadFile(downloadFileDetails *DownloadFileDetails, logMsgPrefix string, ...) (*http.Response, error)
- func (jc *HttpClient) DownloadFileConcurrently(flags ConcurrentDownloadFlags, logMsgPrefix string, ...) error
- func (jc *HttpClient) DownloadFileNoRedirect(downloadPath, localPath, fileName string, ...) (*http.Response, string, error)
- func (jc *HttpClient) GetRemoteFileDetails(downloadUrl string, httpClientsDetails httputils.HttpClientDetails) (*fileutils.FileDetails, error)
- func (jc *HttpClient) IsAcceptRanges(downloadUrl string, httpClientsDetails httputils.HttpClientDetails) (bool, error)
- func (jc *HttpClient) ReadRemoteFile(downloadPath string, httpClientsDetails httputils.HttpClientDetails, ...) (io.ReadCloser, error)
- func (jc *HttpClient) Send(method string, url string, content []byte, followRedirect bool, closeBody bool, ...) (resp *http.Response, respBody []byte, redirectUrl string, err error)
- func (jc *HttpClient) SendDelete(url string, content []byte, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
- func (jc *HttpClient) SendGet(url string, followRedirect bool, ...) (resp *http.Response, respBody []byte, redirectUrl string, err error)
- func (jc *HttpClient) SendHead(url string, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
- func (jc *HttpClient) SendPatch(url string, content []byte, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
- func (jc *HttpClient) SendPost(url string, content []byte, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
- func (jc *HttpClient) SendPut(url string, content []byte, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
- func (jc *HttpClient) Stream(url string, httpClientsDetails httputils.HttpClientDetails) (*http.Response, []byte, string, error)
- func (jc *HttpClient) UploadFile(localPath, url string, httpClientsDetails httputils.HttpClientDetails, ...) (resp *http.Response, body []byte, err error)
- type RetryableConnection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrentDownloadFlags ¶
type ConnectHandler ¶
type DownloadFileDetails ¶
type DownloadFileDetails struct { FileName string `json:"LocalFileName,omitempty"` DownloadPath string `json:"DownloadPath,omitempty"` LocalPath string `json:"LocalPath,omitempty"` LocalFileName string `json:"LocalFileName,omitempty"` ExpectedSha1 string `json:"ExpectedSha1,omitempty"` Size int64 `json:"Size,omitempty"` }
type ErrorHandler ¶
type HttpClient ¶
func NewDefaultHttpClient ¶
func NewDefaultHttpClient() *HttpClient
func NewHttpClient ¶
func NewHttpClient(client *http.Client) *HttpClient
func (*HttpClient) DownloadFile ¶
func (jc *HttpClient) DownloadFile(downloadFileDetails *DownloadFileDetails, logMsgPrefix string, httpClientsDetails httputils.HttpClientDetails, retries int, isExplode bool) (*http.Response, error)
func (*HttpClient) DownloadFileConcurrently ¶
func (jc *HttpClient) DownloadFileConcurrently(flags ConcurrentDownloadFlags, logMsgPrefix string, httpClientsDetails httputils.HttpClientDetails) error
func (*HttpClient) DownloadFileNoRedirect ¶
func (jc *HttpClient) DownloadFileNoRedirect(downloadPath, localPath, fileName string, httpClientsDetails httputils.HttpClientDetails) (*http.Response, string, error)
func (*HttpClient) GetRemoteFileDetails ¶
func (jc *HttpClient) GetRemoteFileDetails(downloadUrl string, httpClientsDetails httputils.HttpClientDetails) (*fileutils.FileDetails, error)
func (*HttpClient) IsAcceptRanges ¶
func (jc *HttpClient) IsAcceptRanges(downloadUrl string, httpClientsDetails httputils.HttpClientDetails) (bool, error)
func (*HttpClient) ReadRemoteFile ¶
func (jc *HttpClient) ReadRemoteFile(downloadPath string, httpClientsDetails httputils.HttpClientDetails, retries int) (io.ReadCloser, error)
Read remote file, The caller is responsible to close the io.ReaderCloser
func (*HttpClient) SendDelete ¶
func (jc *HttpClient) SendDelete(url string, content []byte, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
func (*HttpClient) SendGet ¶
func (jc *HttpClient) SendGet(url string, followRedirect bool, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, respBody []byte, redirectUrl string, err error)
func (*HttpClient) SendHead ¶
func (jc *HttpClient) SendHead(url string, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
func (*HttpClient) SendPatch ¶
func (jc *HttpClient) SendPatch(url string, content []byte, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
func (*HttpClient) SendPost ¶
func (jc *HttpClient) SendPost(url string, content []byte, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
func (*HttpClient) SendPut ¶
func (jc *HttpClient) SendPut(url string, content []byte, httpClientsDetails httputils.HttpClientDetails) (resp *http.Response, body []byte, err error)
func (*HttpClient) Stream ¶
func (jc *HttpClient) Stream(url string, httpClientsDetails httputils.HttpClientDetails) (*http.Response, []byte, string, error)
func (*HttpClient) UploadFile ¶
func (jc *HttpClient) UploadFile(localPath, url string, httpClientsDetails httputils.HttpClientDetails, retries int) (resp *http.Response, body []byte, err error)
type RetryableConnection ¶
type RetryableConnection struct { // ReadTimeout, if read timeout time passes without any data received from the server the connection will be closed. ReadTimeout time.Duration // RetriesNum represents the number of retries following a lost connection, -1 for unlimited RetriesNum int // StableConnectionWindow sets the duration of a stable connection after which the RetriesNum is reset. // If 0 RetriesNum is never reset. // It is recommended to use longer time than ReadTimeout. StableConnectionWindow time.Duration // SleepBetweenRetries sleep time between two retires. SleepBetweenRetries time.Duration // ConnectHandler will be called for connection retry, make sure response body is not closed. ConnectHandler ConnectHandler // ErrorHandler will be called after successful connection for content errors checks. ErrorHandler ErrorHandler }
func (*RetryableConnection) Do ¶
func (rt *RetryableConnection) Do() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.