rest

package
v0.23.3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

An Encoder provides encoding of REST URI path, query, and header components of an HTTP request. Can also encode a stream as the payload.

Does not support SetFields.

func NewEncoder

func NewEncoder(req *http.Request) *Encoder

NewEncoder creates a new encoder from the passed in request. All query and header values will be added on top of the request's existing values. Overwriting duplicate values.

func (*Encoder) AddHeader

func (e *Encoder) AddHeader(key string) HeaderValue

AddHeader returns a HeaderValue for appending to the given header name

func (*Encoder) AddQuery

func (e *Encoder) AddQuery(key string) QueryValue

AddQuery returns a QueryValue used for appending the given query key

func (*Encoder) Encode

func (e *Encoder) Encode() error

Encode returns a REST protocol encoder for encoding HTTP bindings Returns any error if one occurred during encoding.

func (*Encoder) Headers

func (e *Encoder) Headers(prefix string) Headers

Headers returns a Header used encoding headers with the given prefix

func (*Encoder) SetHeader

func (e *Encoder) SetHeader(key string) HeaderValue

SetHeader returns a HeaderValue for setting the given header name

func (*Encoder) SetQuery

func (e *Encoder) SetQuery(key string) QueryValue

SetQuery returns a QueryValue used for setting the given query key

func (*Encoder) SetURI

func (e *Encoder) SetURI(key string) URIValue

SetURI returns a URIValue used for setting the given path key

type HeaderValue

type HeaderValue struct {
	// contains filtered or unexported fields
}

HeaderValue is used to encode values to an HTTP header

func (HeaderValue) Boolean

func (h HeaderValue) Boolean(v bool)

Boolean encodes the value v as a header string value

func (HeaderValue) ByteSlice

func (h HeaderValue) ByteSlice(v []byte)

ByteSlice encodes the value v as a base64 header string value

func (HeaderValue) Float

func (h HeaderValue) Float(v float64)

Float encodes the value v as a header string value

func (HeaderValue) Integer

func (h HeaderValue) Integer(v int64)

Integer encodes the value v as the header string value

func (HeaderValue) JSONValue

func (h HeaderValue) JSONValue(v aws.JSONValue) error

JSONValue encodes the value v as a base64 header string value

func (HeaderValue) String

func (h HeaderValue) String(v string)

String encodes the value v as the header string value

func (HeaderValue) Time

func (h HeaderValue) Time(t time.Time, format string) error

Time encodes the value v using the format name as a header string value

type Headers

type Headers struct {
	// contains filtered or unexported fields
}

Headers is used to encode header keys using a provided prefix

func (Headers) AddHeader

func (h Headers) AddHeader(key string) HeaderValue

AddHeader returns a HeaderValue used to append values to prefix+key

func (Headers) SetHeader

func (h Headers) SetHeader(key string) HeaderValue

SetHeader returns a HeaderValue used to set the value of prefix+key

type QueryValue

type QueryValue struct {
	// contains filtered or unexported fields
}

QueryValue is used to encode query key values

func (QueryValue) Boolean

func (qv QueryValue) Boolean(v bool)

Boolean encodes the value v as a query string value

func (QueryValue) ByteSlice

func (qv QueryValue) ByteSlice(v []byte)

ByteSlice encodes the value v as a base64 query string value

func (QueryValue) Float

func (qv QueryValue) Float(v float64)

Float encodes the value v as a query string value

func (QueryValue) Integer

func (qv QueryValue) Integer(v int64)

Integer encodes the value v as a query string value

func (QueryValue) JSONValue

func (qv QueryValue) JSONValue(v aws.JSONValue) error

JSONValue encodes the value v using the format name as a query string value

func (QueryValue) String

func (qv QueryValue) String(v string)

String encodes the value v as a query string value

func (QueryValue) Time

func (qv QueryValue) Time(v time.Time, format string) error

Time encodes the value v using the format name as a query string value

type URIValue

type URIValue struct {
	// contains filtered or unexported fields
}

URIValue is used to encode named URI parameters

func (URIValue) Boolean

func (u URIValue) Boolean(v bool) error

Boolean encodes the value v as a URI string value

func (URIValue) ByteSlice

func (u URIValue) ByteSlice(v []byte) error

ByteSlice encodes the value v as a base64 URI string value

func (URIValue) Float

func (u URIValue) Float(v float64) error

Float encodes the value v as a URI string value

func (URIValue) Integer

func (u URIValue) Integer(v int64) error

Integer encodes the value v as a URI string value

func (URIValue) JSONValue

func (u URIValue) JSONValue(v aws.JSONValue) error

JSONValue encodes the value v as a URI string value

func (URIValue) String

func (u URIValue) String(v string) error

String encodes the value v as a URI string value

func (URIValue) Time

func (u URIValue) Time(v time.Time, format string) error

Time encodes the value v using the format name as a URI string value

Jump to

Keyboard shortcuts

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