freetextfetcher

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContextActionKey defines the key used in the context to store the action ID
	ContextActionKey = "id"
	// ContextMessageKey defines the key used in the context to store the message
	ContextMessageKey = "message"
	// ContextPayloadKey defines the key used in the context to store the payload
	ContextPayloadKey = "payload"

	// ContextNewMessage defines the key used in the context to store the new message
	ContextNewMessage = "new_message"
	// ContextNewPayload defines the key used in the context to store the new payload
	ContextNewPayload = "new_payload"

	// CancelAction codifies the action to cancel the freetext fetching
	CancelAction = "cancel"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FreetextFetcher

type FreetextFetcher interface {
	MessageHasBeenPosted(c *plugin.Context, post *model.Post, api plugin.API, l logger.Logger, botUserID string, pluginURL string)
	StartFetching(userID string, payload string)
	UpdateHooks(validate func(string) string, onFetch func(string, string), onCancel func(string))
	URL() string
}

FreetextFetcher defines the behavior of free text fetchers

func NewFreetextFetcher

func NewFreetextFetcher(
	baseURL string,
	store FreetextStore,
	validate func(string) string,
	onFetch func(string, string),
	onCancel func(string),
	r *mux.Router,
	p poster.Poster,
) FreetextFetcher

NewFreetextFetcher creates a new FreetextFetcher

type FreetextStore

type FreetextStore interface {
	StartFetching(userID, fetcherID, payload string) error
	StopFetching(userID string) error
	ShouldProcessFreetext(userID, fetcherID string) (bool, string, error)
}

FreetextStore defines the behavior needed to store all the data for the FreetextFetcher

func NewFreetextStore

func NewFreetextStore(apiClient pluginapi.Client, keyPrefix string) FreetextStore

NewFreetextStore creates a new store for the FreetextFetcher

type Manager

type Manager interface {
	MessageHasBeenPosted(c *plugin.Context, post *model.Post, api plugin.API, l logger.Logger, botUserID string, pluginURL string)
	Clear()
}

Manager defines the behavior of the freetext manager

func GetManager

func GetManager() Manager

GetManager gets the current manager or creates one if none is created

Directories

Path Synopsis
Package mock_freetext_fetcher is a generated GoMock package.
Package mock_freetext_fetcher is a generated GoMock package.

Jump to

Keyboard shortcuts

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