rest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: GPL-3.0 Imports: 9 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallAPI

func CallAPI(connRest ConnectorRest, r *Request) (data []byte, err error)

непосредственно вызв того что нам необходимо

func Debug

func Debug(connRest ConnectorRest, format string, v interface{})

вывод в логи все что необходимо для тестов, чтобы не засорять консоль

func Error added in v0.0.8

func Error(connRest ConnectorRest, errName string, err error, fields map[string]string, errText string) error

Types

type ConnectorRest

type ConnectorRest interface {
	GetExchangeName() string
	GetConfiguration() Configuration
	GetClient() *http.Client
	GetLogger() *zap.Logger
	ParseRequest(r *Request)
	GetPair(args ...string) (string, error)
	GetSign(parms ...string) string
}

type Params

type Params map[string]interface{}

type Request

type Request struct {
	Method     string
	Endpoint   string
	Query      url.Values
	Data       []byte  // json data for NewRequest body in client
	RecvWindow int     // specify how long an HTTP request is valid
	SecType    SecType // security type
	Header     http.Header
	FullURL    string
}

Request define an API Request

func NewRequest added in v0.0.5

func NewRequest(method, endpoint string, secType SecType, recvWindow int) *Request

надо прописать default

func (*Request) SetParam

func (r *Request) SetParam(key string, value interface{}) *Request

setParam set param with key/value to query string

func (*Request) SetParams

func (r *Request) SetParams(m Params) *Request

setParams set params with key/values to query string

type SecType

type SecType int32

необходим для того, чтобы понимать, как работать с запросом, нужны ли ему хедерсы, время и т.д.

Jump to

Keyboard shortcuts

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