client

package
v0.0.0-...-f39c433 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Create(title, message string, duration time.Duration) ([]byte, error)
	Edit(id string, title, message string, duration time.Duration) ([]byte, error)
	Fetch(ids []string) ([]byte, error)
	Delete(ids []string) error
	Healthy(host string) bool
}

Client represents the client for communicating with backend API (here HTTP).

type HTTPClient

type HTTPClient struct {
	BackendURI string
	// contains filtered or unexported fields
}

HTTPClient represents the HTTP client which communicates with reminders background API

func NewHTTPClient

func NewHTTPClient(backendURI string) *HTTPClient

NewHTTPClient creates a new instance of HTTPClient

func (HTTPClient) Create

func (c HTTPClient) Create(title, message string, duration time.Duration) ([]byte, error)

Create calls the create API endpoint

func (HTTPClient) Delete

func (c HTTPClient) Delete(ids []string) error

Delete calls the fetch API endpoint

func (HTTPClient) Edit

func (c HTTPClient) Edit(id string, title, message string, duration time.Duration) ([]byte, error)

Edit calls the edit API endpoint

func (HTTPClient) Fetch

func (c HTTPClient) Fetch(ids []string) ([]byte, error)

Fetch calls the fetch API endpoint

func (HTTPClient) Healthy

func (c HTTPClient) Healthy(host string) bool

Healthy checks whether a given host is up and running

type Switch

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

Switch represents CLI command switch

func NewSwitch

func NewSwitch(backendAPIURI string) *Switch

NewSwitch creates new instance of Switch

func (Switch) Help

func (s Switch) Help()

Help prints a useful message about command usage

func (Switch) Switch

func (s Switch) Switch() error

Switch analyses the CLI args end executes the given command

Jump to

Keyboard shortcuts

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