connection

package
v0.0.0-...-62e55b1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadJSON

func ReadJSON(body io.ReadCloser, x interface{}) error

ReadJSON : reads a json response into an interface

func ReadYAML

func ReadYAML(body io.ReadCloser, x interface{}) error

ReadYAML reads

Types

type Conn

type Conn struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Conn : creates a new connection

func New

func New(config *config.Config) *Conn

New : creates a new connection using a given config

func (*Conn) Authenticate

func (c *Conn) Authenticate() (string, error)

Authenticate : authenticate against an ernest instance

func (*Conn) Delete

func (c *Conn) Delete(path string) (*http.Response, error)

Delete : delete a resource on ernest api

func (*Conn) Get

func (c *Conn) Get(path string) (*http.Response, error)

Get : get response from ernest api

func (*Conn) Post

func (c *Conn) Post(path string, ctype string, data []byte) (*http.Response, error)

Post : post data to ernest api

func (*Conn) Put

func (c *Conn) Put(path string, ctype string, data []byte) (*http.Response, error)

Put : put data to ernest api

func (*Conn) Request

func (c *Conn) Request(method, path, ctype string, data []byte, headers map[string]string) (*http.Response, error)

Request : make a raw request to ernest

func (*Conn) Stream

func (c *Conn) Stream(path string, stream string) (chan *sse.Event, error)

Stream : connects to an sse stream, returns a channel

func (*Conn) WSStream

func (c *Conn) WSStream(path string, stream string) (chan []byte, error)

WSStream : connects to a websocket stream, returns a channel

Jump to

Keyboard shortcuts

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