Documentation
¶
Index ¶
- type Server
- func (s *Server) AppDetail(c *gin.Context)
- func (s *Server) AppList(c *gin.Context)
- func (s *Server) Available() gin.HandlerFunc
- func (s *Server) Healthy() bool
- func (s *Server) Serve() (err error)
- func (s *Server) SetHealth(health bool)
- func (s *Server) SetURL(url string)
- func (s *Server) Shutdown() (err error)
- func (s *Server) SignUp(c *gin.Context)
- func (s *Server) Status(c *gin.Context)
- func (s *Server) TopicDetail(c *gin.Context)
- func (s *Server) TopicList(c *gin.Context)
- func (s *Server) URL() string
- func (s *Server) UserCreate(c *gin.Context)
- func (s *Server) UserDetail(c *gin.Context)
- func (s *Server) UserList(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
Server implements the API router and handlers.
func (*Server) Available ¶
func (s *Server) Available() gin.HandlerFunc
Available is middleware that uses healthy boolean to return a service unavailable http status code if the server is shutting down or in maintenance mode. This middleware must be fairly early on in the chain to ensure that complex handling does not slow the shutdown of the server.
func (*Server) SignUp ¶
Signs up a contact to receive notifications from SendGrid by making a request to the SendGrid add contacts marketing API. The SendGrid API is asynchronous, which means that it doesn't return success if the user is registered. Instead a job ID is returned and the endpoint has to check if the registration was actually successful or not. To not block this endpoint, sign up doesn't check success but returns ok if the registration was correctly submitted.
TODO: check for when the user is successfully signed up then send a welcome email. TODO: move all sendgrid-specific functionality into its own helper package. TODO: search for ensign list ID rather than configuring it externally.