client

package
v0.0.0-...-36feab7 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(status int, message string) error

NewError returns a new instance of Error

Types

type Error

type Error struct {
	StatusCode int
	Message    string
}

Error is a custom error type which has a status code.

func (*Error) Error

func (err *Error) Error() string

Error returns the error message.

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

ErrorResponse represents the error response of a request.

type HTTP

type HTTP interface {
	// Get makes a GET request to the given url, then reads a
	// JSON response to the given destination. dest can not be nil.
	Get(url string, dest interface{}) error

	// Post makes a POST request to the given url, with the given body,
	// which will be in JSON format. If dest is not nil, the response
	// body will be JSON decoded to the given destination.
	Post(url string, body, dest interface{}) error
}

HTTP is a high level interface used to wrap the core http package, resulting in making HTTP requests simplier among services, using a standardised response pattern.

func NewHTTP

func NewHTTP(baseURL string) HTTP

NewHTTP returns a new instance of HTTP with a base url.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
auth
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
media
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
users
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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