Documentation ¶
Index ¶
- func Init()
- func NewRouter(s Server) *mux.Router
- type Constants
- type LoginResponse
- type MetricPermissions
- type NewRegistration
- type NewUser
- type NotificationPermissions
- type Permission
- type Permissions
- type RefreshTokenHandlerResponse
- type RegistrationResponse
- type RequestHelper
- type Server
- func (s Server) CreateUser() http.HandlerFunc
- func (s *Server) DeleteSession() http.HandlerFunc
- func (s *Server) ErrorResponse(w http.ResponseWriter, r *http.Request, statusCode int, message string)
- func (s Server) GetUser() http.HandlerFunc
- func (s *Server) ListPermissions() http.HandlerFunc
- func (s Server) ListUsers() http.HandlerFunc
- func (s *Server) LoginHandler() http.HandlerFunc
- func (s *Server) RefreshTokenHandler() http.HandlerFunc
- func (s *Server) RefreshTokensList() http.HandlerFunc
- func (s *Server) RegisterHandler() http.HandlerFunc
- func (s *Server) SuccessResponse(w http.ResponseWriter, r *http.Request, statusCode int, message string)
- func (s Server) UpdateUser() http.HandlerFunc
- func (s Server) UserAvailability() http.HandlerFunc
- type SimpleResponse
- type UserAvailabilityRequest
- type UserAvailabilityResponse
- type UserPermission
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Constants ¶
type Constants struct {
Permissions Permissions
}
Constants structure for storing constants application wide
type LoginResponse ¶
LoginResponse responds with this type when login is successful
type MetricPermissions ¶
type MetricPermissions struct {
View string
}
MetricPermissions permissions related to metric
type NewRegistration ¶
type NewRegistration struct {
Token string `json:"token"`
}
NewRegistration used for making a registration request
type NewUser ¶
type NewUser struct { Email string `json:"email"` Password string `json:"password"` Permissions []string `json:"permissions"` }
NewUser for creating a new user
type NotificationPermissions ¶
NotificationPermissions permissions related to notifications
type Permissions ¶
type Permissions struct { Sudo string User UserPermission Permissions Permission Notifications NotificationPermissions Metrics MetricPermissions }
Permissions store all available types of permission this application supports
type RefreshTokenHandlerResponse ¶
type RefreshTokenHandlerResponse struct {
JWT string `json:"jwt"`
}
RefreshTokenHandlerResponse is used when a refresh token is requested
type RegistrationResponse ¶
type RegistrationResponse struct {
Status string `json:"status"`
}
RegistrationResponse response for registration request
type RequestHelper ¶
RequestHelper interface to implement to satisfy as a Request Helper for this application
type Server ¶
type Server struct { Logger logger.Client Db db.DB Redis redis.Client Pushy pushy.IPushyClient ReqHelper RequestHelper Jwt jwt.Manager }
Server is a global struct which holds implementation of different things application depends on. One can think of this as dependency container
func (Server) CreateUser ¶
func (s Server) CreateUser() http.HandlerFunc
CreateUser handler used for creating new users
func (*Server) DeleteSession ¶
func (s *Server) DeleteSession() http.HandlerFunc
DeleteSession deletes a session, used for logging out
func (*Server) ErrorResponse ¶
func (s *Server) ErrorResponse(w http.ResponseWriter, r *http.Request, statusCode int, message string)
ErrorResponse util method to indicate failure
func (Server) GetUser ¶
func (s Server) GetUser() http.HandlerFunc
GetUser to get information about a user
func (*Server) ListPermissions ¶
func (s *Server) ListPermissions() http.HandlerFunc
ListPermissions is handler for listing permissions
func (Server) ListUsers ¶
func (s Server) ListUsers() http.HandlerFunc
ListUsers used for listing all users
func (*Server) LoginHandler ¶
func (s *Server) LoginHandler() http.HandlerFunc
LoginHandler handles login requests
func (*Server) RefreshTokenHandler ¶
func (s *Server) RefreshTokenHandler() http.HandlerFunc
RefreshTokenHandler is used to refresh token
func (*Server) RefreshTokensList ¶
func (s *Server) RefreshTokensList() http.HandlerFunc
RefreshTokensList returns list of refresh token associated with a user
func (*Server) RegisterHandler ¶
func (s *Server) RegisterHandler() http.HandlerFunc
RegisterHandler is handler for registration requests
func (*Server) SuccessResponse ¶
func (s *Server) SuccessResponse(w http.ResponseWriter, r *http.Request, statusCode int, message string)
SuccessResponse util method to indicate success
func (Server) UpdateUser ¶
func (s Server) UpdateUser() http.HandlerFunc
UpdateUser to update information about user
func (Server) UserAvailability ¶
func (s Server) UserAvailability() http.HandlerFunc
UserAvailability for checking if a email is already taken
type SimpleResponse ¶
SimpleResponse is used when our handler wants to responds with simple boolean type information, like success, or fail
type UserAvailabilityRequest ¶
type UserAvailabilityRequest struct {
Email string `json:"email"`
}
UserAvailabilityRequest used for making request asking if email is available
type UserAvailabilityResponse ¶
type UserAvailabilityResponse struct {
Available bool `json:"available"`
}
UserAvailabilityResponse is used to respond for availability requests
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |