api

package
v1.29.0-mobile.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: BSD-2-Clause Imports: 15 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"
)

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) ApplyUpdatersToUserByID added in v1.2.0

func (a *API) ApplyUpdatersToUserByID(userID string, updaters []UserUpdater) (*user.User, error)

func (*API) ApplyUpdatersToUserByObject added in v1.2.0

func (a *API) ApplyUpdatersToUserByObject(updateUser *user.User, updaters []UserUpdater) (*user.User, error)

func (*API) CheckToken

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

func (*API) DeleteDataSet added in v1.28.0

func (a *API) DeleteDataSet(dataSetID string) error

func (*API) DeleteUserByID added in v1.2.0

func (a *API) DeleteUserByID(userID string, password string) error

func (*API) FindUsers added in v1.2.0

func (a *API) FindUsers(query *UsersQuery) ([]*user.User, error)

func (*API) GetUserByEmail added in v1.2.0

func (a *API) GetUserByEmail(email string) (*user.User, error)

func (*API) GetUserByID added in v1.2.0

func (a *API) GetUserByID(userID string) (*user.User, error)

func (*API) IsSessionUserID added in v1.2.0

func (a *API) IsSessionUserID(userID string) bool

func (*API) ListDataSets added in v1.28.0

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

func (*API) Login

func (a *API) Login(email string, password string) (*user.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

func (*API) UpdateUserByID added in v1.2.0

func (a *API) UpdateUserByID(userID string, userUpdates *UserUpdates) (*user.User, error)

func (*API) UpdateUserByObject added in v1.2.0

func (a *API) UpdateUserByObject(updateUser *user.User, userUpdates *UserUpdates) (*user.User, error)

type AddRolesUserUpdater added in v1.2.0

type AddRolesUserUpdater struct {
	Roles []string
}

func NewAddRolesUserUpdater added in v1.2.0

func NewAddRolesUserUpdater(roles []string) (*AddRolesUserUpdater, error)

func (*AddRolesUserUpdater) Update added in v1.2.0

func (a *AddRolesUserUpdater) Update(updateUser *user.User, userUpdates *UserUpdates) 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 RemoveRolesUserUpdater added in v1.2.0

type RemoveRolesUserUpdater struct {
	Roles []string
}

func NewRemoveRolesUserUpdater added in v1.2.0

func NewRemoveRolesUserUpdater(roles []string) (*RemoveRolesUserUpdater, error)

func (*RemoveRolesUserUpdater) Update added in v1.2.0

func (r *RemoveRolesUserUpdater) Update(updateUser *user.User, userUpdates *UserUpdates) error

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 UserDelete added in v1.2.0

type UserDelete struct {
	Password *string `json:"password,omitempty"`
}

type UserUpdater added in v1.2.0

type UserUpdater interface {
	Update(updateUser *user.User, userUpdates *UserUpdates) error
}

type UserUpdates added in v1.2.0

type UserUpdates struct {
	Username      *string   `json:"username,omitempty"`
	Emails        *[]string `json:"emails,omitempty"`
	Password      *string   `json:"password,omitempty"`
	Roles         *[]string `json:"roles,omitempty"`
	TermsAccepted *string   `json:"termsAccepted,omitempty"`
	EmailVerified *bool     `json:"emailVerified,omitempty"`
}

func (*UserUpdates) HasUpdates added in v1.2.0

func (u *UserUpdates) HasUpdates() bool

type UsersQuery added in v1.2.0

type UsersQuery struct {
	Role *string `json:"role,omitempty"`
}

Jump to

Keyboard shortcuts

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