handlers

package
v0.0.0-...-205cd9e Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendError

func SendError(w http.ResponseWriter, data interface{})

SendError sends Response with {status: "error"}

func SendSuccess

func SendSuccess(w http.ResponseWriter, data interface{})

SendSuccess sends Response with {status: "success"}

Types

type FinchHandler

type FinchHandler func(w http.ResponseWriter, r *http.Request) (interface{}, error)

FinchHandler .

func (FinchHandler) ServeHTTP

func (fn FinchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Handlers

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

Handlers .

func NewHandlers

func NewHandlers(stg storage.Storage, alt alerter.Alerter, lgr logger.InfoErrorLogger, auth *auth.Auth, counterChannel chan bool, config *config.AppConfig) *Handlers

NewHandlers initializes handlers

func (*Handlers) AlertDetail

func (h *Handlers) AlertDetail(w http.ResponseWriter, r *http.Request) (interface{}, error)

AlertDetail returns alert object or it's history

func (*Handlers) Alerts

func (h *Handlers) Alerts(w http.ResponseWriter, r *http.Request) (interface{}, error)

Alerts creates new alert

func (*Handlers) CreateUser

func (h *Handlers) CreateUser(w http.ResponseWriter, r *http.Request) (interface{}, error)

CreateUser creates a new user

func (*Handlers) ProcessAlert

func (h *Handlers) ProcessAlert(alertID string) error

ProcessAlert processes the alert

type Response

type Response struct {
	Status string      `json:"status"`
	Data   interface{} `json:"data,omitempty"`
}

Response is the general response struct

Jump to

Keyboard shortcuts

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