Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiSpec ¶
type ApiSpec interface {
// IsCrypto indicates whether the API request uses EC-crypto.
IsCrypto() bool
// SetCryptoKey adds crypto key in parameters.
SetCryptoKey(key string)
// Url returns the request URL of API.
Url() string
// Payload returns the request body of API.
Payload() Payload
// Parse parses the response body.
Parse(r io.Reader) (err error)
}
ApiSpec describes the specification of an 115 API.
type Body ¶ added in v0.7.4
type Body interface {
io.ReadCloser
// Size returns body size or -1 when unknown.
Size() int64
}
type Client ¶
type Client interface {
// GetUserAgent returns current "User-Agent" value.
GetUserAgent() string
// ExportCookies exports cookies for specific URL.
ExportCookies(url string) map[string]string
// CallApi calls an API.
CallApi(spec ApiSpec, context context.Context) error
// Get performs an HTTP GET request.
Get(
url string, headers map[string]string, context context.Context,
) (body Body, err error)
// Post performs an HTTP POST request.
Post(
url string, payload Payload, headers map[string]string, context context.Context,
) (body Body, err error)
}
Client is the low-level client which executes ApiSpec.
Click to show internal directories.
Click to hide internal directories.