rest

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonArray

func JsonArray(j interface{}) []interface{}

func JsonObjectGet

func JsonObjectGet(j interface{}, key string) interface{}

func JsonString

func JsonString(j interface{}) string

Types

type Error

type Error struct {
	Text string
	Code int
}

func NewError

func NewError(code int, text string) *Error

func NewErrorFromResponse

func NewErrorFromResponse(resp *http.Response) *Error

func (Error) Error

func (e Error) Error() string

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient() *HTTPClient

func (*HTTPClient) Get

func (c *HTTPClient) Get(ctx context.Context, url string, headers ...HTTPHeader) ([]byte, error)

func (*HTTPClient) GetJSONArray

func (c *HTTPClient) GetJSONArray(ctx context.Context, url string, headers ...HTTPHeader) ([]interface{}, error)

func (*HTTPClient) GetJSONObject

func (c *HTTPClient) GetJSONObject(ctx context.Context, url string, headers ...HTTPHeader) (map[string]interface{}, error)

type HTTPHeader

type HTTPHeader struct {
	Name  string
	Value string
}

func NewHTTPHeader

func NewHTTPHeader(name, value string) HTTPHeader

Jump to

Keyboard shortcuts

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