slack

package
v0.0.0-...-5ff6d09 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NumberOptions

func NumberOptions(left, right int) []*slack.OptionBlockObject

Types

type AddingAnswererHandler

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

genconstructor

func NewAddingAnswererHandler

func NewAddingAnswererHandler(
	slackClient *slack.Client,
	usecase application.AddingAnswererUsecase,
) AddingAnswererHandler

func (AddingAnswererHandler) Execute

func (AddingAnswererHandler) HandleAddingAnswerer

func (h AddingAnswererHandler) HandleAddingAnswerer(
	ctx context.Context,
	input AddingAnswererHandlerInput,
	actionName string,
	value string,
) (AddingAnswererHandlerInput, domain.Error)

func (AddingAnswererHandler) PrintFixed

func (h AddingAnswererHandler) PrintFixed(
	ctx context.Context,
	channelID string,
	updateTargetID null.String,
	input AddingAnswererHandlerInput,
) domain.Error

func (AddingAnswererHandler) RequestInput

func (h AddingAnswererHandler) RequestInput(
	ctx context.Context,
	channelID string,
	updateTargetID null.String,
	callbackID string,
	input AddingAnswererHandlerInput,
) domain.Error

type AddingAnswererHandlerInput

type AddingAnswererHandlerInput struct {
	QuestionnaireID string
	AnswererID      string
	ChannelID       string
	UserID          string
	NeedsMention    bool
}

func (AddingAnswererHandlerInput) ToUsecaseInput

type Answer

type Answer struct {
	Question Question
	Value    string
}

type AnsweringHandler

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

genconstructor

func NewAnsweringHandler

func NewAnsweringHandler(
	slackClient *slack.Client,
	usecase application.AnsweringUsecase,
) AnsweringHandler

func (AnsweringHandler) Execute

func (AnsweringHandler) HandleAnswering

func (h AnsweringHandler) HandleAnswering(
	ctx context.Context,
	input AnsweringHandlerInput,
	actionName string,
	value string,
) (AnsweringHandlerInput, domain.Error)

func (AnsweringHandler) PrintFixed

func (h AnsweringHandler) PrintFixed(
	ctx context.Context,
	channelID string,
	updateTargetID null.String,
	input AnsweringHandlerInput,
) domain.Error

func (AnsweringHandler) RequestInput

func (h AnsweringHandler) RequestInput(
	ctx context.Context,
	channelID string,
	updateTargetID null.String,
	callbackID string,
	input AnsweringHandlerInput,
) domain.Error

type AnsweringHandlerInput

type AnsweringHandlerInput struct {
	QuestionnaireID    string
	QuestionnaireTitle string
	AnswererID         string
	Answers            []Answer
}

func (AnsweringHandlerInput) ToUsecaseInput

type Callback

type Callback struct {
	Token   string
	Actions []CallbackAction

	Container struct {
		ChannelID string `json:"channel_id"`
		MessageTS string `json:"message_ts"`
	}
}

type CallbackAction

type CallbackAction struct {
	ActionID       string `json:"action_id"`
	BlockID        string `json:"block_id"`
	Value          string `json:"value"`
	SelectedOption struct {
		Value string
	} `json:"selected_option"`
	SelectedDate         string `json:"selected_date"`
	SelectedUser         string `json:"selected_user"`
	SelectedConversation string `json:"selected_conversation"`
	SelectedChannel      string `json:"selected_channel"`
}

type CreatingAnswererHandler

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

genconstructor

func NewCreatingAnswererHandler

func NewCreatingAnswererHandler(
	slackClient *slack.Client,
	usecase application.CreatingAnswererUsecase,
) CreatingAnswererHandler

func (CreatingAnswererHandler) Execute

func (CreatingAnswererHandler) HandleCreatingAnswerer

func (h CreatingAnswererHandler) HandleCreatingAnswerer(
	ctx context.Context,
	input CreatingAnswererHandlerInput,
	actionName string,
	value string,
) (CreatingAnswererHandlerInput, domain.Error)

func (CreatingAnswererHandler) PrintFixed

func (h CreatingAnswererHandler) PrintFixed(
	ctx context.Context,
	channelID string,
	updateTargetID null.String,
	input CreatingAnswererHandlerInput,
) domain.Error

func (CreatingAnswererHandler) RequestInput

func (h CreatingAnswererHandler) RequestInput(
	ctx context.Context,
	channelID string,
	updateTargetID null.String,
	callbackID string,
	input CreatingAnswererHandlerInput,
) domain.Error

type CreatingAnswererHandlerInput

type CreatingAnswererHandlerInput struct {
	Name string
}

func (CreatingAnswererHandlerInput) ToUsecaseInput

type EditingQuestionnaireHandler

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

genconstructor

func NewEditingQuestionnaireHandler

func NewEditingQuestionnaireHandler(
	slackClient *slack.Client,
	creatingQuestionnaireUsecase application.CreatingQuestionnaireUsecase,
	updatingQuestionnaireUsecase application.UpdatingQuestionnaireUsecase,
) EditingQuestionnaireHandler

func (EditingQuestionnaireHandler) Execute

func (EditingQuestionnaireHandler) HandleEditingQuestionnaire

func (EditingQuestionnaireHandler) PrintFixed

func (h EditingQuestionnaireHandler) PrintFixed(
	ctx context.Context,
	channelID string,
	updateTargetID null.String,
	input EditingQuestionnaireHandlerInput,
	questionnaireID string,
) domain.Error

func (EditingQuestionnaireHandler) RequestInput

func (h EditingQuestionnaireHandler) RequestInput(
	ctx context.Context,
	channelID string,
	updateTargetID null.String,
	callbackID string,
	input EditingQuestionnaireHandlerInput,
) domain.Error

type EditingQuestionnaireHandlerInput

type EditingQuestionnaireHandlerInput struct {
	ID          string
	Title       string
	Questions   []Question
	Schedules   Schedules
	PostTargets PostTargets
}

func (*EditingQuestionnaireHandlerInput) FromDomainObject

func (p *EditingQuestionnaireHandlerInput) FromDomainObject(questionnaire domain.Questionnaire)

func (EditingQuestionnaireHandlerInput) ToCreatingUsecaseInput

func (EditingQuestionnaireHandlerInput) ToUpdatingUsecaseInput

type HTTPHandler

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

genconstructor

func NewHTTPHandler

func NewHTTPHandler(
	slackVerificationToken string,
	logger *zap.Logger,
	questionnaireSearcher domain.QuestionnaireSearcher,
	answererSearcher domain.AnswererSearcher,
	editingQuestionnaireHandler EditingQuestionnaireHandler,
	creatingAnswererHandler CreatingAnswererHandler,
	addingAnswererHandler AddingAnswererHandler,
	answeringHandler AnsweringHandler,
	paramStore ParamStore,
) HTTPHandler

func (HTTPHandler) HandleEvent

func (h HTTPHandler) HandleEvent(w http.ResponseWriter, r *http.Request)

func (HTTPHandler) HandleInteractiveComponent

func (h HTTPHandler) HandleInteractiveComponent(w http.ResponseWriter, r *http.Request)

func (HTTPHandler) HandleSuggestion

func (h HTTPHandler) HandleSuggestion(w http.ResponseWriter, r *http.Request)

type InmemoryStore

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

func NewInmemoryStore

func NewInmemoryStore() InmemoryStore

func (InmemoryStore) Restore

func (s InmemoryStore) Restore(ctx context.Context, key string, valuePtr interface{}) error

func (InmemoryStore) Store

func (s InmemoryStore) Store(ctx context.Context, key string, value interface{}, expiration time.Duration) error

type ParamStore

type ParamStore interface {
	Store(ctx context.Context, key string, value interface{}, expiration time.Duration) error
	Restore(ctx context.Context, key string, valuePtr interface{}) error
}

type PostTargets

type PostTargets struct {
	SlackPostTargets []SlackPostTarget
}

func RestorePostTargetFromDomainObject

func RestorePostTargetFromDomainObject(s domain.PostTarget) PostTargets

func (PostTargets) Merge

func (s PostTargets) Merge(t PostTargets) PostTargets

type Poster

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

genconstructor

func NewPoster

func NewPoster(
	slackClient *slack.Client,
) Poster

func (Poster) Post

func (s Poster) Post(ctx context.Context, target domain.PostTargetSlack, questionnaire domain.Questionnaire, answerer domain.Answerer, answers []domain.Answer) domain.Error

type Question

type Question struct {
	ID       string
	Text     string
	Required bool
}

type Schedules

type Schedules struct {
	WeekdayAndTimeSchedules        []WeekdayAndTimeSchedule
	YearMonthDayScheduleExceptions []YearMonthDayScheduleException
}

func RestoreSchedulesFromDomainObject

func RestoreSchedulesFromDomainObject(s domain.Schedule) Schedules

func (Schedules) Merge

func (s Schedules) Merge(t Schedules) Schedules

type SlackPostTarget

type SlackPostTarget struct {
	ChannelID string
}

type StoreValue

type StoreValue struct {
	ExpiredAt time.Time
	Value     []byte
}

type SuggestionRequestPayload

type SuggestionRequestPayload struct {
	Token    string
	ActionID string `json:"action_id"`
	Value    string
}

type WeekdayAndTimeSchedule

type WeekdayAndTimeSchedule struct {
	Hour     uint32
	Minute   uint32
	Sec      uint32
	Timezone int
	Mon      bool
	Tue      bool
	Wed      bool
	Thu      bool
	Fri      bool
	Sat      bool
	Sun      bool
}

type YearMonthDayScheduleException

type YearMonthDayScheduleException struct {
	Year     uint32
	Month    uint32
	Day      uint32
	Timezone int
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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