rest

package
v0.26.4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyInterface

func CopyInterface(dst, src interface{})

func MapErrors

func MapErrors(resp *resty.Response, err error, okCodes ...int) error

MapErrors -- trys to extract errors from resty response, check http statuses and pack resulting info to error

Types

type P

type P map[string]string

P -- URL path params

type Q

type Q map[string]string

Q -- URL query params

type REST

type REST interface {
	identity.Changer
	Get(Rq) error
	Put(Rq) error
	Post(Rq) error
	Delete(Rq) error
}

REST -- rest client interface

type Rq

type Rq struct {
	Result interface{}
	Body   interface{}
	URL    URL
	Query  Q
	Token  string
}

Rq -- request params

type URL

type URL struct {
	Path   string
	Params P
}

func (*URL) Build

func (u *URL) Build() string

type UnexpectedHTTPstatusError

type UnexpectedHTTPstatusError struct {
	Status  int
	Message string
}

UnexpectedHTTPstatusError -- contains HTTP status code and message

func (*UnexpectedHTTPstatusError) Error

func (err *UnexpectedHTTPstatusError) Error() string

Directories

Path Synopsis
ermockerr
Code generated by noice.
Code generated by noice.

Jump to

Keyboard shortcuts

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