client

package
v0.0.0-...-d87a525 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l Logger)

SetLogger sets logger for the package.

Types

type AccountCreateRequest

type AccountCreateRequest struct {
	Email string `json:"email"`
}

AccountCreateRequest ...

type AccountVerifyEmailRequest

type AccountVerifyEmailRequest struct {
	Code string `json:"code"`
}

AccountCreateRequest ...

type Client

type Client struct {
	*hclient.Client
}

Client ...

func New

func New(urs string) (*Client, error)

New creates a Client for the a Web API.

func (*Client) AccountCreate

func (c *Client) AccountCreate(ctx context.Context, account *keys.EdX25519Key, email string) error

func (*Client) AccountVerify

func (c *Client) AccountVerify(ctx context.Context, account *keys.EdX25519Key, code string) error

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, key *keys.EdX25519Key) error

Delete from vault API.

func (*Client) Events

func (c *Client) Events(ctx context.Context, key *keys.EdX25519Key, index int64) (*Events, error)

Events from vault API. If truncated, there are more results if you call again with the new index.

func (*Client) Get

func (c *Client) Get(ctx context.Context, vault *keys.EdX25519Key) (*Vault, error)

Get a vault. Returns nil if not found.

func (*Client) Post

func (c *Client) Post(ctx context.Context, key *keys.EdX25519Key, data [][]byte) error

Post events to the vault API with a key.

func (*Client) Register

func (c *Client) Register(ctx context.Context, key *keys.EdX25519Key, account *keys.EdX25519Key) (*api.Key, error)

func (*Client) Status

func (c *Client) Status(ctx context.Context, vlts []*Vault) ([]*RemoteStatus, error)

Status ...

type Event

type Event struct {
	VID             keys.ID   `db:"vid"`
	Data            []byte    `db:"data"`
	RemoteIndex     int64     `db:"ridx"`
	RemoteTimestamp time.Time `db:"rts"`
}

Event pulled from remote.

type Events

type Events struct {
	Events    []*Event
	Index     int64
	Truncated bool
}

Events ...

type LogLevel

type LogLevel int

LogLevel ...

const (
	// DebugLevel ...
	DebugLevel LogLevel = 3
	// InfoLevel ...
	InfoLevel LogLevel = 2
	// WarnLevel ...
	WarnLevel LogLevel = 1
	// ErrLevel ...
	ErrLevel LogLevel = 0
)

func (LogLevel) String

func (l LogLevel) String() string

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}

Logger interface used in this package.

func NewLogger

func NewLogger(lev LogLevel) Logger

NewLogger ...

type RemoteStatus

type RemoteStatus struct {
	ID        keys.ID `json:"id" msgpack:"id"`
	Index     int64   `json:"idx" msgpack:"idx"`
	Timestamp int64   `json:"ts" msgpack:"ts"`
}

RemoteStatus ...

type Vault

type Vault struct {
	ID        keys.ID `json:"id"`
	Token     string  `json:"token"`
	Timestamp int64   `json:"ts"`
}

Vault ...

Jump to

Keyboard shortcuts

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