Documentation ¶
Index ¶
- func JWTMiddleware(h http.Handler) http.Handler
- func LoggingMiddleware(h http.Handler) http.Handler
- func NewUserToken(userId string, session *mgo.Session) (string, error)
- func RecoveryMiddleware(h http.Handler) http.Handler
- type FrontendHandlers
- func (h *FrontendHandlers) Authenticate(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandlers) CreateTimer(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandlers) DeleteTimer(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandlers) MonthStatistics(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandlers) ProjectsData(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandlers) TimersData(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandlers) UpdateTimer(w http.ResponseWriter, r *http.Request)
- type Handlers
- func (h *Handlers) ClearAllData(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) Health(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) NotImplemented(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) SendSampleMessageFromBot(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) SlackOauth2Redirect(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) Timer(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) ValidateAuthToken(w http.ResponseWriter, r *http.Request)
- type JWTResponse
- type JwtToken
- type ProjectsResponse
- type ResponseBody
- type ResponseStatus
- type SecureContext
- type SlackOAuth
- type SlackOAuthImpl
- type TimerResponse
- type TimersResponse
- type UserStatisticsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewUserToken ¶
Types ¶
type FrontendHandlers ¶
type FrontendHandlers struct {
// contains filtered or unexported fields
}
Handlers is a collection of net/http handlers to serve the API
func NewFrontendHandlers ¶
func NewFrontendHandlers(env *utils.Environment, mongoSession *mgo.Session) *FrontendHandlers
NewHandlers constructs a FrontendHandler collection
func (*FrontendHandlers) Authenticate ¶
func (h *FrontendHandlers) Authenticate(w http.ResponseWriter, r *http.Request)
func (*FrontendHandlers) CreateTimer ¶
func (h *FrontendHandlers) CreateTimer(w http.ResponseWriter, r *http.Request)
func (*FrontendHandlers) DeleteTimer ¶
func (h *FrontendHandlers) DeleteTimer(w http.ResponseWriter, r *http.Request)
func (*FrontendHandlers) MonthStatistics ¶
func (h *FrontendHandlers) MonthStatistics(w http.ResponseWriter, r *http.Request)
func (*FrontendHandlers) ProjectsData ¶
func (h *FrontendHandlers) ProjectsData(w http.ResponseWriter, r *http.Request)
func (*FrontendHandlers) TimersData ¶
func (h *FrontendHandlers) TimersData(w http.ResponseWriter, r *http.Request)
func (*FrontendHandlers) UpdateTimer ¶
func (h *FrontendHandlers) UpdateTimer(w http.ResponseWriter, r *http.Request)
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers is a collection of net/http handlers to serve the API
func NewHandlers ¶
func NewHandlers(env *utils.Environment, mongoSession *mgo.Session) *Handlers
NewHandlers constructs a Handlers collection
func (*Handlers) ClearAllData ¶
func (h *Handlers) ClearAllData(w http.ResponseWriter, r *http.Request)
ClearAllData - is supposed to be called by the QA team during early testing stage
func (*Handlers) Health ¶
func (h *Handlers) Health(w http.ResponseWriter, r *http.Request)
Health handles a call for app health request
func (*Handlers) NotImplemented ¶
func (h *Handlers) NotImplemented(w http.ResponseWriter, r *http.Request)
func (*Handlers) SendSampleMessageFromBot ¶
func (h *Handlers) SendSampleMessageFromBot(w http.ResponseWriter, r *http.Request)
func (*Handlers) SlackOauth2Redirect ¶
func (h *Handlers) SlackOauth2Redirect(w http.ResponseWriter, r *http.Request)
SlackOauth2Redirect handles the OAuth2 redirect from Slack and exchanges the `code` with `accessToken` https://api.slack.com/methods/oauth.access
func (*Handlers) Timer ¶
func (h *Handlers) Timer(w http.ResponseWriter, r *http.Request)
Timer handles Slack /timer command
func (*Handlers) ValidateAuthToken ¶
func (h *Handlers) ValidateAuthToken(w http.ResponseWriter, r *http.Request)
type JWTResponse ¶
type JWTResponse struct { *ResponseBody ResponseData JwtToken `json:"data"` }
Response with jwt token
func NewJWTResponse ¶
func NewJWTResponse(info map[string]string) *JWTResponse
type ProjectsResponse ¶
type ProjectsResponse struct { *ResponseBody ResponseData []*models.Project `json:"data"` }
Response with array of projects data
func NewProjectsResponse ¶
func NewProjectsResponse(info map[string]string) *ProjectsResponse
type ResponseBody ¶
type ResponseBody struct { AppInfo map[string]string `json:"app_info"` ResponseStatus *ResponseStatus `json:"response_status"` ResponseData map[string]string `json:"data"` }
Common response body for frontend application
func NewResponseBody ¶
func NewResponseBody(info map[string]string) *ResponseBody
type ResponseStatus ¶
type SecureContext ¶
type SecureContext struct { Origin string Session *mgo.Session Env *utils.Environment }
func (*SecureContext) CorsMiddleware ¶
func (c *SecureContext) CorsMiddleware(h http.Handler) http.Handler
func (*SecureContext) CurrentUserMiddleware ¶
func (c *SecureContext) CurrentUserMiddleware(h http.Handler) http.Handler
type SlackOAuth ¶
type SlackOAuth interface {
GetOAuthResponse(clientID, clientSecret, code string) (*slack.OAuthResponse, error)
}
type SlackOAuthImpl ¶
type SlackOAuthImpl struct { }
func NewSlackOAuth ¶
func NewSlackOAuth() *SlackOAuthImpl
func (*SlackOAuthImpl) GetOAuthResponse ¶
func (*SlackOAuthImpl) GetOAuthResponse(clientID, clientSecret, code string) (*slack.OAuthResponse, error)
type TimerResponse ¶
type TimerResponse struct { *ResponseBody ResponseData models.Timer `json:"data"` }
Response with task data
func NewTimerResponse ¶
func NewTimerResponse(info map[string]string) *TimerResponse
type TimersResponse ¶
type TimersResponse struct { *ResponseBody ResponseData []*models.Timer `json:"data"` }
Response with array of tasks data
func NewTimersResponse ¶
func NewTimersResponse(info map[string]string) *TimersResponse
type UserStatisticsResponse ¶
type UserStatisticsResponse struct { *ResponseBody ResponseData []*models.UserStatisticsAggregation `json:"data"` }
Response with array of user month statistics data
func NewUserStatisticsResponse ¶
func NewUserStatisticsResponse(info map[string]string) *UserStatisticsResponse