api

package
v0.0.0-...-f0e13e9 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthPreRequest

func AuthPreRequest(next echo.HandlerFunc) echo.HandlerFunc

AuthPreRequest is the middleware function.

Types

type ComedianAPI

type ComedianAPI struct {
	// contains filtered or unexported fields
}

ComedianAPI struct used to handle slack requests (slash commands)

func New

func New(config *config.Config, db *storage.DB, bundle *i18n.Bundle) *ComedianAPI

New creates API instance

func (*ComedianAPI) HandleCallbackEvent

func (api *ComedianAPI) HandleCallbackEvent(event slackevents.EventsAPICallbackEvent) error

HandleCallbackEvent choses bot to deal with event and then handles event

func (*ComedianAPI) HandleEvent

func (api *ComedianAPI) HandleEvent(incomingEvent model.ServiceEvent) error

HandleEvent sends message to Slack Workspace

func (*ComedianAPI) SelectBot

func (api *ComedianAPI) SelectBot(team string) (*botuser.Bot, error)

SelectBot returns bot by its team id or teamname if found

func (*ComedianAPI) Start

func (api *ComedianAPI) Start() error

Start starts http server

type Event

type Event struct {
	Token     string `json:"token"`
	Challenge string `json:"challenge"`
	Type      string `json:"type"`
}

Event represents slack challenge event

type LoginPayload

type LoginPayload struct {
	Code        string `json:"code"`
	RedirectURI string `json:"redirect_uri"`
}

LoginPayload represents loginPayload from UI

Jump to

Keyboard shortcuts

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