request

package
v0.0.0-...-da4fad4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package request provides the HTTP request functionality for the PHPIPAM API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	// The HTTP result code.
	Code int

	// The response data. This is further unmarshaled into the data type set by
	// Request.Output.
	Data json.RawMessage

	// The error message, if the request failed.
	Message string

	// Whether or not the API request was successful.
	Success bool
}

APIResponse represents a PHPIPAM response body. Both successful and unsuccessful requests share the same response format.

type Request

type Request struct {
	// The API session.
	Session *session.Session

	// The request method.
	Method string

	// The request URI.
	URI string

	// The request data.
	Input interface{}

	// The output of the request. This corresponds to the "data" field in a
	// response.
	Output interface{}
}

Request represents the API request.

func NewRequest

func NewRequest(s *session.Session) *Request

NewRequest creates a new request instance with configuration set.

func (*Request) Send

func (r *Request) Send() error

Send sends a request to the API endpoint, and parsees the response.

Note that by design, Send does not handle redirects - if you get a 302 error or some other sort of 300 error from the SDK, please check your API endpoints.

Jump to

Keyboard shortcuts

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