http

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClient

func SetClient(c Client)

func SetRateLimit added in v0.1.1

func SetRateLimit(enabled bool, perMinute int, burst int)

SetRateLimit configures the global per-route SDK request limiter. Passing enabled=false disables limiter waits while preserving GET merging.

func SetRateLimitEnabled added in v0.1.1

func SetRateLimitEnabled(enabled bool)

SetRateLimitEnabled toggles the global per-route SDK request limiter.

Types

type Client

type Client interface {
	Do(req *http.Request) (*http.Response, error)
}

func GetClient

func GetClient() Client

type HTTPMethod

type HTTPMethod string
const (
	GET    HTTPMethod = "GET"
	POST   HTTPMethod = "POST"
	PUT    HTTPMethod = "PUT"
	DELETE HTTPMethod = "DELETE"
)

type PendingRequest added in v0.0.9

type PendingRequest struct {
	Response any // 用于缓存成功响应的结果
	// contains filtered or unexported fields
}

PendingRequest 用于保存正在进行的请求和等待结果的调用方

type Request

type Request[Req any, Res any] struct {
	BaseURL     string
	HTTPMethod  HTTPMethod
	Route       string
	Method      string
	AccessToken string
	Request     Req
	Response    Res
}

func (*Request[Req, Res]) Do

func (api *Request[Req, Res]) Do() (Res, error)

Jump to

Keyboard shortcuts

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