request

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operation

type Operation struct {
	Name        string
	HTTPMethod  string
	HTTPPath    string
	QueryParams map[string]string
}

An Operation is the service API operation to be made.

type PingAccessError

type PingAccessError struct {
	models.ApiErrorView
}

PingFederateError occurs when PingFederate returns a non 2XX response

func (*PingAccessError) Error

func (r *PingAccessError) Error() (message string)

type Request

type Request struct {
	Config     config.Config
	ClientInfo metadata.ClientInfo

	AttemptTime  time.Time
	Time         time.Time
	Operation    *Operation
	HTTPRequest  *http.Request
	HTTPResponse *http.Response
	Body         io.ReadSeeker
	BodyStart    int64 // offset from beginning of Body that the request body starts
	Params       interface{}
	Error        error
	Data         interface{}
	RequestID    string
}

A Request is the service request to be made.

func New

func New(cfg config.Config, clientInfo metadata.ClientInfo, operation *Operation, params interface{}, data interface{}) *Request

New returns a new Request pointer for the service API operation and parameters.

Params is any value of input parameters to be the request payload. Data is pointer value to an object which the request's response payload will be deserialized to.

func (*Request) CheckResponse

func (r *Request) CheckResponse()

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.

func (*Request) DataFilled

func (r *Request) DataFilled() bool

DataFilled returns true if the request's data for response deserialization target has been set and is a valid. False is returned if data is not set, or is invalid.

func (*Request) Send

func (r *Request) Send() error

Send will send the request, returning error if errors are encountered.

Jump to

Keyboard shortcuts

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