internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorFromResponse

func GetErrorFromResponse(res *http.Response) error

func Min

func Min(a int, b int) int

func UnmarshalResponse

func UnmarshalResponse(res *http.Response, dst interface{}) error

Types

type APIStatus

type APIStatus struct {
	Code    int           `json:"code"`
	Message string        `json:"message"`
	Details []interface{} `json:"details"`
}

type ApiError

type ApiError struct {
	Code    int           `json:"code"`
	Message string        `json:"message"`
	Status  string        `json:"status"`
	Details []interface{} `json:"details,omitempty"`
}

func (ApiError) Error

func (a ApiError) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error ApiError `json:"error"`
}

type HttpClient

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

func NewHttpClient

func NewHttpClient(c *http.Client) *HttpClient

func (*HttpClient) FetchWithGet

func (c *HttpClient) FetchWithGet(path string, queryValues interface{}, responseModel interface{}, reqCb func(req *http.Request), ctx context.Context) error

func (*HttpClient) PatchJSON added in v0.2.0

func (c *HttpClient) PatchJSON(path string, queryValues interface{}, body interface{}, responseModel interface{}, reqCb func(req *http.Request), ctx context.Context) error

func (*HttpClient) PostFile

func (c *HttpClient) PostFile(path string, queryValues interface{}, file io.Reader, responseModel interface{}, reqCb func(req *http.Request), ctx context.Context) error

func (*HttpClient) PostJSON

func (c *HttpClient) PostJSON(path string, queryValues interface{}, body interface{}, responseModel interface{}, reqCb func(req *http.Request), ctx context.Context) error

Jump to

Keyboard shortcuts

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