utils

package
v0.0.0-...-a287f25 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorCode = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpClient

type HttpClient struct {
	// contains filtered or unexported fields
}

func NewHttpClient

func NewHttpClient(transport *http.Transport) *HttpClient

func (*HttpClient) Delete

func (h *HttpClient) Delete(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)

func (*HttpClient) Get

func (h *HttpClient) Get(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)

func (*HttpClient) Post

func (h *HttpClient) Post(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)

func (*HttpClient) Put

func (h *HttpClient) Put(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)

func (*HttpClient) Request

func (h *HttpClient) Request(method, u string, params []KeyValue, requestBody interface{}, headers []KeyValue) (err error, code int, respBody []byte)

type IHttpClient

type IHttpClient interface {
	Request(method, url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
	Get(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
	Post(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
	Delete(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
	Put(url string, params []KeyValue, body interface{}, header []KeyValue) (error, int, []byte)
}

type KeyValue

type KeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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