api

package
v0.0.0-...-84617a3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func New

func New(service ServiceHTTP, accounts map[string]string) *API

func (*API) RegisterAccount

func (api *API) RegisterAccount(username, password string)

func (*API) Run

func (api *API) Run(port int) error

type KeyPairPayload

type KeyPairPayload struct {
	UserID string
}

type KeyPairResult

type KeyPairResult struct {
	UserID    string
	PublicKey []byte
}

type NewKeyPairPayload

type NewKeyPairPayload struct {
	UserID string
}

type NewTokenPayload

type NewTokenPayload struct {
	UserID string
}

type Notification

type Notification struct {
	Title   string
	Body    string
	Options []string
}

type NotificationPayload

type NotificationPayload struct {
	To           []string
	Notification Notification
}

type NotificationResult

type NotificationResult struct {
	Ok            bool
	Notifications map[string]string
}

type ServiceHTTP

type ServiceHTTP interface {
	SendNotificationHTTP(*NotificationPayload) (*NotificationResult, error)
	// GenerateNewKeyPairHTTP(*NewKeyPairPayload) (*KeyPairResult, error)
	GenerateNewTokenForUserHTTP(*NewTokenPayload) (*TokenResult, error)
	// GetKeyPairHTTP(*KeyPairPayload) (*KeyPairResult, error)
	GetTokenHTTP(*TokenPayload) (*TokenResult, error)
}

type TokenPayload

type TokenPayload struct {
	UserID string
}

type TokenResult

type TokenResult struct {
	UserID string
	Token  string
}

Jump to

Keyboard shortcuts

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