api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2016 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ConfigDirectoryName = ".tidepool"
	SessionFileName     = "session"
)
View Source
const (
	TidepoolServerName   = "x-tidepool-server-name"
	TidepoolServerSecret = "x-tidepool-server-secret"
	TidepoolSessionToken = "x-tidepool-session-token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Name     string
	Endpoint string
	Writer   io.Writer
	Verbose  bool
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(name string, endpoint string, proxy string) (*API, error)

func (*API) CheckToken

func (a *API) CheckToken(token string) (*Token, error)

func (*API) DeleteDataset

func (a *API) DeleteDataset(datasetID string) error

func (*API) ListDatasets

func (a *API) ListDatasets(userID string, filter *Filter, pagination *Pagination) (*ResponseArray, error)

func (*API) Login

func (a *API) Login(email string, password string) (*User, error)

func (*API) Logout

func (a *API) Logout() error

func (*API) RefreshToken

func (a *API) RefreshToken() (*Token, error)

func (*API) ServerLogin

func (a *API) ServerLogin() error

type Error

type Error struct {
	Code   string      `json:"code,omitempty"`
	Title  string      `json:"title,omitempty"`
	Detail string      `json:"detail,omitempty"`
	Status int         `json:"status,string,omitempty"`
	Source *Source     `json:"source,omitempty"`
	Meta   interface{} `json:"meta,omitempty"`
}

type Filter

type Filter struct {
	Deleted *bool
}

type Meta

type Meta struct {
	Trace *Trace `json:"trace,omitempty"`
}

type Pagination

type Pagination struct {
	Page *int
	Size *int
}

type ResponseArray

type ResponseArray struct {
	Data   []interface{} `json:"data,omitempty"`
	Errors []*Error      `json:"errors,omitempty"`
	Meta   *Meta         `json:"meta,omitempty"`
}

type ResponseObject

type ResponseObject struct {
	Data   interface{} `json:"data,omitempty"`
	Errors []*Error    `json:"errors,omitempty"`
	Meta   *Meta       `json:"meta,omitempty"`
}

type Session

type Session struct {
	Token    string `json:"token"`
	IsServer bool   `json:"isServer"`
	UserID   string `json:"userId,omitempty"`
}

type Source

type Source struct {
	Parameter string `json:"parameter,omitempty"`
	Pointer   string `json:"pointer,omitempty"`
}

type Token

type Token struct {
	IsServer bool   `json:"isserver"`
	UserID   string `json:"userid"`
}

type Trace

type Trace struct {
	Request string `json:"request,omitempty"`
	Session string `json:"session,omitempty"`
}

type User

type User struct {
	ID             string   `json:"userid,omitempty"`
	Username       string   `json:"username,omitempty"`
	Emails         []string `json:"emails,omitempty"`
	Roles          []string `json:"roles,omitempty"`
	TermsAccepted  string   `json:"termsAccepted,omitempty"`
	EmailVerified  bool     `json:"emailVerified,omitempty"`
	PasswordExists bool     `json:"passwordExists,omitempty"`
}

Jump to

Keyboard shortcuts

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