Documentation ¶
Index ¶
- Variables
- func GetEndpointURI(host string, method string) string
- func IsConduitError(err error) bool
- func MakeRequest(endpointURL string, params interface{}, options *ClientOptions) (*http.Request, error)
- func PerformCall(endpointURL string, params interface{}, result interface{}, ...) error
- func PerformCallContext(ctx context.Context, endpointURL string, params interface{}, ...) error
- type Client
- type ClientOptions
- type ConduitError
Constants ¶
This section is empty.
Variables ¶
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 ¶
GetEndpointURI formats a hostname and method name into an endpoint URI.
func IsConduitError ¶
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.
func PerformCallContext ¶ added in v0.4.0
func PerformCallContext( ctx context.Context, endpointURL string, params interface{}, result interface{}, options *ClientOptions, ) error
PerformCallContext performs a call to the Conduit API with the context, 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 Client ¶ added in v0.4.0
An Client performs http.Requests. It captures the Do method of the http.Client.
type ClientOptions ¶
type ClientOptions struct { APIToken string Cert string CertUser string SessionKey string InsecureSkipVerify bool Timeout time.Duration // If set, Client will be used to execute HTTP requests. // Otherwise, one is created with default settings and // InsecureSkipVerify respected. Client Client }
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.