client

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 2 Imported by: 0

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 Client

type Client interface {

	// GetUserAgent returns current "User-Agent" value.
	GetUserAgent() string

	// ExportCookies exports cookies for specific URL.
	ExportCookies(url string) map[string]string

	// Get performs an HTTP GET request.
	Get(url string, headers map[string]string, context context.Context) (body io.ReadCloser, err error)

	// CallApi calls an API.
	CallApi(spec ApiSpec, context context.Context) error
}

Client is the low-level client which executes ApiSpec.

type Payload

type Payload interface {
	io.Reader

	// ContentType returns the MIME type of payload.
	ContentType() string

	// ContentLength returns the size in bytes of payload.
	ContentLength() int64
}

Payload describes the request body.

Jump to

Keyboard shortcuts

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