http

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Errors []struct {
		Message string `json:"message"`
		Status  int    `json:"status"`
	} `json:"errors"`
}

func (APIError) Error

func (e APIError) Error() error

type HTTPClient

type HTTPClient interface {
	RequestJSON(ctx context.Context, method, path string, in interface{}, out interface{}, mods ...RequestModifier) ([]byte, http.Header, int, error)
	PostJSON(ctx context.Context, path string, in interface{}, out interface{}, mods ...RequestModifier) (int, error)
	PutJSON(ctx context.Context, path string, in interface{}, out interface{}, mods ...RequestModifier) (int, error)
	GetJSON(ctx context.Context, path string, out interface{}, mods ...RequestModifier) (int, error)
	DeleteJSON(ctx context.Context, path string, out interface{}, mods ...RequestModifier) (int, error)
}

HTTPClient is a interface for HTTPClient mock

func NewClient

func NewClient(host, token string) HTTPClient

type RequestModifier

type RequestModifier func(req *http.Request)

RequestModifier is used to modify behavior of Request and Steam functions

func SetHeader

func SetHeader(key, value string) RequestModifier

SetHeader modify headers of http.Request

func WithQueryParameter

func WithQueryParameter(key, value string) RequestModifier

WithQueryParameter add query parameters to your http.Request

Jump to

Keyboard shortcuts

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