core

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2016 License: MIT Imports: 10 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrJSONOutputUnsupported is returned when conduit doesn't support JSON
	// output.
	ErrJSONOutputUnsupported = errors.New("JSON output is not supported")

	// ErrURLEncodedInputUnsupported is returned when conduit doesn't support
	// URL encoded input.
	ErrURLEncodedInputUnsupported = errors.New(
		"urlencoded input not supported",
	)

	// ErrSessionAuthUnsupported is returned when conduit doesn't support
	// session authentication.
	ErrSessionAuthUnsupported = errors.New(
		"Session authentication is not supported",
	)

	// ErrMissingResults is returned when the "results" key is missing from the
	// response object.
	ErrMissingResults = errors.New(
		"Results key was not provided in the response object.",
	)

	// ErrTokenAuthUnsupported is returned when conduit doesn't support token
	// authentication.
	ErrTokenAuthUnsupported = errors.New(
		"Token authentication is not supported",
	)
)

Functions

func GetEndpointURI

func GetEndpointURI(host string, method string) string

GetEndpointURI formats a hostname and method name into an endpoint URI.

func IsConduitError

func IsConduitError(err error) bool

IsConduitError checks whether or not err is a ConduitError.

func MakeRequest

func MakeRequest(
	endpointURL string,
	params interface{},
	options *ClientOptions,
) (*http.Request, error)

MakeRequest creates a new requests to the conduit API.

func PerformCall

func PerformCall(
	endpointURL string,
	params interface{},
	result interface{},
	options *ClientOptions,
) error

PerformCall performs a call to the Conduit API with the provided URL and parameters. The response will be unmarshaled into the passed result struct.

If an error is encountered, it will be unmarshalled into a ConduitError struct.

Types

type ClientOptions

type ClientOptions struct {
	APIToken string

	Cert       string
	CertUser   string
	SessionKey string

	InsecureSkipVerify bool
}

ClientOptions are options that can be set on the HTTP client.

type ConduitError

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

ConduitError is returned when conduit requests return an error response.

func (*ConduitError) Code

func (err *ConduitError) Code() string

Code returns the error_code returned in a conduit response.

func (*ConduitError) Error

func (err *ConduitError) Error() string

func (*ConduitError) Info

func (err *ConduitError) Info() string

Info returns the error_info returned in a conduit response.

Jump to

Keyboard shortcuts

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