restapi

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuhtorizationController

type AuhtorizationController struct{}

type AuthorizationContext

type AuthorizationContext struct {
	User string
}

type Controller

type Controller func(w http.ResponseWriter, r *http.Request)

type DefaultHomepage

type DefaultHomepage struct {
	CorrelationID string `json:"id" bson:"_id" yaml:"id"`
	Timestamp     string `json:"timestamp" bson:"timestamp" yaml:"timestamp"`
	Message       string `json:"message" bson:"message" yaml:"message"`
}

type HttpListener

type HttpListener struct {
	Router      *mux.Router
	Services    *executionctx.ServiceProvider
	Logger      *logger.Logger
	Options     *HttpListenerOptions
	Controllers []Controller
	Servers     []*http.Server
}

HttpListener HttpListener structure

func GetHttpListener

func GetHttpListener() *HttpListener

func NewHttpListener

func NewHttpListener() *HttpListener

NewHttpListener Creates a new controller

func (*HttpListener) AddAuthentication

func (l *HttpListener) AddAuthentication() *HttpListener

func (*HttpListener) AddController

func (l *HttpListener) AddController(c Controller, path string, methods ...string)

func (*HttpListener) AddDefaultHomepage

func (l *HttpListener) AddDefaultHomepage() *HttpListener

func (*HttpListener) AddHealthCheck

func (l *HttpListener) AddHealthCheck() *HttpListener

func (*HttpListener) AddJsonContent

func (l *HttpListener) AddJsonContent() *HttpListener

func (*HttpListener) AddLogger

func (l *HttpListener) AddLogger() *HttpListener

func (*HttpListener) Login

func (l *HttpListener) Login(w http.ResponseWriter, r *http.Request)

Login Generate a token for a valid user

func (*HttpListener) Probe

func (c *HttpListener) Probe(w http.ResponseWriter, r *http.Request)

Login Generate a token for a valid user

func (*HttpListener) Start

func (l *HttpListener) Start()

func (*HttpListener) Validate

func (l *HttpListener) Validate(w http.ResponseWriter, r *http.Request)

Validate Validate a token for a valid user

type HttpListenerOptions

type HttpListenerOptions struct {
	ApiPrefix               string
	HttpPort                string
	EnableTLS               bool
	TLSPort                 string
	TLSCertificate          string
	TLSPrivateKey           string
	UseAuthBackend          bool
	MongoDbConnectionString string
	DatabaseName            string
	EnableAuthentication    bool
}

type LoginErrorResponse

type LoginErrorResponse struct {
	Code    string `json:"code" yaml:"code"`
	Error   string `json:"error"`
	Message string `json:"message"`
}

LoginErrorResponse entity

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" bson:"username" yaml:"username"`
	Password string `json:"password" bson:"password" yaml:"username"`
}

LoginRequest entity

type LoginResponse

type LoginResponse struct {
	AccessToken string `json:"access_token"`
	Expiring    string `json:"expiring"`
}

LoginResponse entity

type User

type User struct {
	ID        string `json:"id" bson:"_id"`
	Email     string `json:"email" bson:"email"`
	Username  string `json:"username" bson:"username"`
	FirstName string `json:"firstName" bson:"firstName"`
	LastName  string `json:"lastName" bson:"lastName"`
	Password  string `json:"password" bson:"password"`
}

User entity

func GetDefaultUsers

func GetDefaultUsers() []User

Jump to

Keyboard shortcuts

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