http

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 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 Client

type Client struct {
	// contains filtered or unexported fields
}

Client HTTP客户端

func NewClient

func NewClient(baseURL string, timeout time.Duration) *Client

NewClient 创建新的HTTP客户端

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, url, destPath string, callback ProgressCallback) error

DownloadFile 下载文件

func (*Client) DownloadWithAuth added in v1.0.2

func (c *Client) DownloadWithAuth(ctx context.Context, url, apiKey, destPath string, expectedSize int64, callback ProgressCallback) error

DownloadWithAuth 带认证的下载文件

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, result interface{}) error

Get 发送GET请求

func (*Client) GetWithAuth added in v1.0.2

func (c *Client) GetWithAuth(ctx context.Context, path string, apiKey string, result interface{}) error

GetWithAuth 发送带认证的GET请求

type ProgressCallback

type ProgressCallback func(downloaded, total int64)

ProgressCallback 下载进度回调函数类型

Jump to

Keyboard shortcuts

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