models

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Payload

type Payload struct {
	Response ResponseDetails `json:"response"`
	Request  RequestDetails  `json:"request"`
}

Payload structure holds request and response structure

func NewPayloadFromBytes

func NewPayloadFromBytes(data []byte) (*Payload, error)

NewPayloadFromBytes decodes supplied bytes into Payload structure

func (*Payload) ConvertToPayloadView

func (p *Payload) ConvertToPayloadView() *PayloadView

func (*Payload) Encode

func (p *Payload) Encode() ([]byte, error)

Encode method encodes all exported Payload fields to bytes

func (Payload) Id

func (p Payload) Id() string

type PayloadView

type PayloadView struct {
	Response ResponseDetailsView `json:"response"`
	Request  RequestDetailsView  `json:"request"`
}

PayloadView is used when marshalling and unmarshalling payloads.

func (*PayloadView) ConvertToPayload

func (r *PayloadView) ConvertToPayload() Payload

func (*PayloadView) Encode

func (p *PayloadView) Encode() ([]byte, error)

Encode method encodes all exported Payload fields to bytes

type PayloadViewData

type PayloadViewData struct {
	Data []PayloadView `json:"data"`
}

type RequestDetails

type RequestDetails struct {
	Path        string              `json:"path"`
	Method      string              `json:"method"`
	Destination string              `json:"destination"`
	Scheme      string              `json:"scheme"`
	Query       string              `json:"query"`
	Body        string              `json:"body"`
	Headers     map[string][]string `json:"headers"`
}

RequestDetails stores information about request, it's used for creating unique hash and also as a payload structure

func (*RequestDetails) ConvertToRequestDetailsView

func (r *RequestDetails) ConvertToRequestDetailsView() RequestDetailsView

func (*RequestDetails) Hash

func (r *RequestDetails) Hash() string

type RequestDetailsView

type RequestDetailsView struct {
	Path        string              `json:"path"`
	Method      string              `json:"method"`
	Destination string              `json:"destination"`
	Scheme      string              `json:"scheme"`
	Query       string              `json:"query"`
	Body        string              `json:"body"`
	Headers     map[string][]string `json:"headers"`
}

RequestDetailsView is used when marshalling and unmarshalling RequestDetails

func (*RequestDetailsView) ConvertToRequestDetails

func (r *RequestDetailsView) ConvertToRequestDetails() RequestDetails

type ResponseDetails

type ResponseDetails struct {
	Status  int                 `json:"status"`
	Body    string              `json:"body"`
	Headers map[string][]string `json:"headers"`
}

ResponseDetails structure hold response body from external service, body is not decoded and is supposed to be bytes, however headers should provide all required information for later decoding by the client.

func (*ResponseDetails) ConvertToResponseDetailsView

func (r *ResponseDetails) ConvertToResponseDetailsView() ResponseDetailsView

type ResponseDetailsView

type ResponseDetailsView struct {
	Status      int                 `json:"status"`
	Body        string              `json:"body"`
	EncodedBody bool                `json:"encodedBody"`
	Headers     map[string][]string `json:"headers"`
}

ResponseDetailsView is used when marshalling and unmarshalling requests. This struct's Body may be Base64 encoded based on the EncodedBody field.

func (*ResponseDetailsView) ConvertToResponseDetails

func (r *ResponseDetailsView) ConvertToResponseDetails() ResponseDetails

Jump to

Keyboard shortcuts

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