Documentation ¶
Index ¶
- Constants
- type Server
- type Slack
- func (s *Slack) HandleEvents(w http.ResponseWriter, r *http.Request) error
- func (s *Slack) HandleMonthlyUpdate(w http.ResponseWriter, r *http.Request) error
- func (s *Slack) HandleReactionAddedEvent(e *slackevents.ReactionAddedEvent) error
- func (s *Slack) HandleReactionEvent(memSlackUID string, update func(m *statsd.Member)) error
- func (s *Slack) HandleReactionRemovedEvent(e *slackevents.ReactionRemovedEvent) error
- type Slacker
Constants ¶
const ( ThumbsUp = "+1" ThumbsDown = "-1" )
const ShutdownTimeout = 1 * time.Second
ShutdownTimeout is the time given for outstanding requests to finish before shutdown.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents an HTTP server. It is meant to wrap all http functionality used by the application so that dependent packages (such as cmd/statsd) do not need to reference the "net/http" package at all.
type Slack ¶
type Slack struct { // Services used by Slack LeaderboardService statsd.LeaderboardService MemberService statsd.MemberService // contains filtered or unexported fields }
Slack represents a service for handling specific Slack events.
func (*Slack) HandleEvents ¶
handleEvents handles Slack push events.
func (*Slack) HandleMonthlyUpdate ¶
HandleMonthlyUpdate sends a summary of the recorded metrics into Slack.
Expecting x-www-form-urlencoded payload in the form of `channel=<channelID>&date=<month>-<year>`. I.e. to represent October 2023, the key=value combination would be `date=10-2023`.
func (*Slack) HandleReactionAddedEvent ¶
func (s *Slack) HandleReactionAddedEvent(e *slackevents.ReactionAddedEvent) error
HandleReactionAddedEvent handles the event when a user reacts to the post of another user.
func (*Slack) HandleReactionEvent ¶
HandleReactionEvent handles an event by updating the member with the specified slackUID.
func (*Slack) HandleReactionRemovedEvent ¶
func (s *Slack) HandleReactionRemovedEvent(e *slackevents.ReactionRemovedEvent) error
HandleReactionRemovedEvent handles the event when a user removes a reaction from another user's post.
type Slacker ¶
type Slacker interface { HandleEvents(w http.ResponseWriter, r *http.Request) error HandleMonthlyUpdate(w http.ResponseWriter, r *http.Request) error }
Slacker represents a service for handling Slack push events.
func NewSlackService ¶
func NewSlackService(logger *slog.Logger, ms statsd.MemberService, ls statsd.LeaderboardService, signingSecret string, botSigningKey string) (Slacker, error)
NewSlackService creates a new instance of slackService.