Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CredsFromClient ¶ added in v0.1.6
func CredsFromClient(c Client) *types.Credentials
CredsFromClient extracts Credentials from a Client when it implements the credentialedClient interface; returns nil otherwise.
func SetRateLimit ¶ added in v0.1.1
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 ¶
func ClientFor ¶ added in v0.1.6
ClientFor returns the per-call client when non-nil, otherwise the global client. Exported so callers outside the http package (e.g. file.Download) can resolve a per-call client with the same fallback semantics as Request.Do.
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 HTTPClient Client Credentials *types.Credentials }
Request is the generic API-call builder. HTTPClient is optional; when nil the global client (GetClient) is used, allowing per-call client isolation. Credentials is optional; when non-nil it takes precedence over the package- level types.* globals for $-prefixed default resolution and AccessToken.