api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package api provides the daemon API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Session *SessionClient
	Version *VersionClient
	// contains filtered or unexported fields
}

Client exposes the daemon API.

func NewClient

func NewClient(cfg *config.Config) *Client

NewClient returns a new Client.

func (*Client) Do

func (c *Client) Do(ctx context.Context, r *http.Request, v interface{}) (*http.Response, error)

Do executes an http.Request, populating v with the JSON response on success.

If the request errors with a JSON formatted response body, it will be unmarshaled into the returned error.

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, query *url.Values,
	body interface{}) (*http.Request, error)

NewRequest constructs a new http.Request, with a body containing the json representation of body, if provided.

type SessionClient

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

SessionClient provides access to the daemon's user session related endpoints, for logging in/out, and checking your session status.

func (*SessionClient) Get

Get returns the status of the user's session.

func (*SessionClient) Login

func (s *SessionClient) Login(ctx context.Context, email, passphrase string) error

Login logs the user in using the provided email and passphrase

type VersionClient

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

VersionClient provides access to the daemon's /v1/version endpoint, for inspecting the daemon's release version.

func (*VersionClient) Get

Get returns the daemon's release version.

Jump to

Keyboard shortcuts

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