client

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const MethodGET = "GET"
View Source
const MethodPOST = "POST"
View Source
const V1 = "1.0"
View Source
const V2 = "2.0"

Variables

View Source
var (
	NoHttp200ResponseError = errors.New("unexpected response")
)

Errors

View Source
var (
	NotSupportedMethod = errors.New("unsupported method")
)

Errors

Functions

func NewClientConfig

func NewClientConfig(url, user, key string, l *log.Logger) (*clientConfig, error)

func NewGenericRequest

func NewGenericRequest(action string, method string) *genericRequest

func NewResponseBuilder

func NewResponseBuilder() responseBuilder

Types

type Client

type Client interface {
	Call(request Request) (Response, error)
	GetLogger() *log.Logger
}

func NewClient

func NewClient(clientConfig clientConfig, l *log.Logger) Client

type ClientUrlBuilder

type ClientUrlBuilder interface {
	BuildUrl(requestParams url.Values) (string, error)
}

func NewClientUrlBuilder

func NewClientUrlBuilder(clientConfig clientConfig) ClientUrlBuilder

type DatetimeProvider

type DatetimeProvider interface {
	// contains filtered or unexported methods
}

type ErrorResponse

type ErrorResponse struct {
	HeadObject HeadErrorResponse `json:"Head"`
	Head       []byte
}

func (ErrorResponse) GetBody

func (er ErrorResponse) GetBody() []byte

func (ErrorResponse) GetHead

func (er ErrorResponse) GetHead() []byte

func (ErrorResponse) GetHeadObject

func (er ErrorResponse) GetHeadObject() interface{}

func (ErrorResponse) IsError

func (er ErrorResponse) IsError() bool

type FakeClient added in v1.1.0

type FakeClient struct {
	FakeResponse Response
	FakeError    error
}

func (FakeClient) Call added in v1.1.0

func (c FakeClient) Call(request Request) (Response, error)

func (FakeClient) GetLogger added in v1.1.0

func (c FakeClient) GetLogger() *log.Logger

type HashHmacRequestSignature

type HashHmacRequestSignature interface {
	// contains filtered or unexported methods
}

type HeadErrorResponse added in v1.1.0

type HeadErrorResponse struct {
	ErrorCode    string `json:"ErrorCode"`
	ErrorMessage string `json:"ErrorMessage"`
}

type Request

type Request interface {
	GetMethod() string
	GetRequestParams() url.Values
	GeneratePostXml() ([]byte, error)
	SetVersion(v string)
	SetRequestParam(key string, value string)
	SetPostData(data interface{})
}

type Response

type Response interface {
	IsError() bool
	GetHeadObject() interface{}
	GetHead() []byte
	GetBody() []byte
}

type ResponseBuilder

type ResponseBuilder interface {
	BuildResponse(response http.Response) (Response, error)
}

type SuccessResponse

type SuccessResponse struct {
	HeadObject headSuccessResponse
	Head       []byte
	Body       []byte
}

func (SuccessResponse) GetBody

func (sr SuccessResponse) GetBody() []byte

func (SuccessResponse) GetHead

func (sr SuccessResponse) GetHead() []byte

func (SuccessResponse) GetHeadObject

func (sr SuccessResponse) GetHeadObject() interface{}

func (SuccessResponse) IsError

func (sr SuccessResponse) IsError() bool

Jump to

Keyboard shortcuts

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