client

package
v0.0.0-...-b072d08 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package client contains a client to send http requests to a swagger API. This implementation is untyped

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKeyAuth

func APIKeyAuth(name, in, value string) client.AuthInfoWriter

APIKeyAuth provides an API key auth info writer

func BasicAuth

func BasicAuth(username, password string) client.AuthInfoWriter

BasicAuth provides a basic auth info writer

func BearerToken

func BearerToken(token string) client.AuthInfoWriter

BearerToken provides a header based oauth2 bearer access token auth info writer

Types

type APIError

type APIError struct {
	Method        string
	Path          string
	OperationName string
	Payload       []byte
	Code          int
}

APIError wraps an error model and captures the status code

func NewAPIError

func NewAPIError(opName string, payload []byte, code int) *APIError

NewAPIError creates a new API error

func (*APIError) Error

func (a *APIError) Error() string

type Runtime

type Runtime struct {
	DefaultMediaType      string
	DefaultAuthentication client.AuthInfoWriter
	Consumers             map[string]httpkit.Consumer
	Producers             map[string]httpkit.Producer

	Transport http.RoundTripper
	//Spec      *spec.Document
	Host     string
	BasePath string
	Formats  strfmt.Registry
	Debug    bool
	// contains filtered or unexported fields
}

Runtime represents an API client that uses the transport to make http requests based on a swagger specification.

func New

func New(host, basePath string, schemes []string) *Runtime

New creates a new default runtime for a swagger api client.

func (*Runtime) Submit

func (r *Runtime) Submit(operation *client.Operation) (interface{}, error)

Submit a request and when there is a body on success it will turn that into the result all other things are turned into an api error for swagger which retains the status code

Jump to

Keyboard shortcuts

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