models

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: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeHTTP .
	TypeHTTP = "http"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID          bson.ObjectId `bson:"_id" json:"id"`
	Name        string        `bson:"name,omitempty" json:"name,omitempty"`
	AlertDate   time.Time     `bson:"alertDate,omitempty" json:"alertDate"`
	Channel     string        `bson:"channel,omitempty" json:"channel"`
	Method      string        `bson:"method,omitempty" json:"method,omitempty"`
	ContentType string        `bson:"contentType,omitempty" json:"contentType,omitempty"`
	URL         string        `bson:"url,omitempty" json:"url,omitempty"`
	Data        string        `bson:"data,omitempty" json:"data,omitempty"`
	Schedule    *Schedule     `bson:"schedule,omitempty" json:"schedule,omitempty"`
	Enabled     bool          `json:"enabled"`
	User        bson.ObjectId `json:"-"`
}

Alert struct represents alert data stored in storage

func NewAlert

func NewAlert() *Alert

NewAlert creates a new Alert struct

type CreateAlertRequest

type CreateAlertRequest struct {
	Token       string `json:"token"`
	Name        string `json:"name"`
	Channel     string `json:"channel"`
	URL         string `json:"url"`
	Method      string `json:"method"`
	ContentType string `json:"contentType"`
	Data        string `json:"data"`
	AlertDate   string `json:"alertDate"`
	AlertAfter  int    `json:"alertAfter"`
	RepeatEvery int    `json:"repeatEvery"`
	RepeatCount int    `json:"repeatCount"`
}

CreateAlertRequest .

func (*CreateAlertRequest) Validate

func (r *CreateAlertRequest) Validate() error

Validate validates CreateAlertRequest

type CreateAlertResponse

type CreateAlertResponse struct {
	AlertDate string `json:"alertDate"`
}

CreateAlertResponse .

type CreateUserRequest

type CreateUserRequest struct {
	Name  *string `json:"name"`
	Email *string `json:"email"`
}

CreateUserRequest .

func (*CreateUserRequest) Validate

func (r *CreateUserRequest) Validate() error

Validate validates CreateUserRequest

type CreateUserResponse

type CreateUserResponse struct {
	Token   string `json:"token"`
	Expires int64  `json:"expires"`
}

CreateUserResponse .

type GetAlertsResponse

type GetAlertsResponse struct {
	Alerts []*Alert `json:"alerts"`
	Count  int      `json:"count"`
}

GetAlertsResponse .

type ProcessAlert

type ProcessAlert struct {
	Type       string        `json:"type"`
	Alert      bson.ObjectId `json:"-"`
	StatusCode int           `json:"responseStatusCode"`
	CreatedAt  time.Time     `json:"date"`
}

ProcessAlert .

type Schedule

type Schedule struct {
	RepeatEvery int `bson:"repeatEvery,omitempty" json:"repeatEvery,omitempty"`
	RepeatCount int `bson:"repeatCount" json:"repeatCount"`
}

Schedule represents schedule of alert

type UpdateAlertRequest

type UpdateAlertRequest struct {
	Enabled *bool `json:"enabled"`
}

UpdateAlertRequest .

type User

type User struct {
	ID    bson.ObjectId `bson:"_id"`
	Name  string
	Email string
}

User .

Jump to

Keyboard shortcuts

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