Documentation
¶
Index ¶
- Variables
- type ActionType
- type ConversationID
- type ConversationStatus
- type ConversationStatusType
- type DailyScheduler
- type Event
- func (e *Event) ConversationID() ConversationID
- func (e *Event) FilterText(target string) bool
- func (e *Event) HandleTypeMessage(ctx context.Context, f func(context.Context, *Event) error) error
- func (e *Event) HandleTypePostback(ctx context.Context, f func(context.Context, *Event) error) error
- func (e *Event) ReadTextLines() []string
- func (e *Event) SetStatus(st ConversationStatusType)
- type Executor
- type ExecutorType
- type Item
- type ListType
- type OneshotScheduler
- type ReminderItem
- type ReminderItemID
- type ReminderItemIDJSON
- type ReminderItems
- type ReminderReplyType
- type Scheduler
- type ShoppingItem
- type ShoppingItems
- type ShoppingReplyType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEndSchedule = errors.New("end of schedule") ErrInvalidSchedulerType = errors.New("invalid scheduler type") )
View Source
var ErrConversationStatusValidationFailed = errors.New("conversation status validation failed")
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType int
const ( ActionTypeUnknown ActionType = iota ActionTypeDelete )
type ConversationID ¶
type ConversationID string
func NewConversationID ¶
func NewConversationID(prefix, sourceID string) ConversationID
func (ConversationID) SourceID ¶
func (c ConversationID) SourceID() string
func (ConversationID) String ¶
func (c ConversationID) String() string
type ConversationStatus ¶
type ConversationStatus struct { ConversationID ConversationID Type ConversationStatusType }
func (*ConversationStatus) Validate ¶
func (m *ConversationStatus) Validate() error
type ConversationStatusType ¶
type ConversationStatusType int
const ( ConversationStatusTypeNeutral ConversationStatusType = iota ConversationStatusTypeShopping ConversationStatusTypeShoppingAdd ConversationStatusTypeReminderAdd )
type DailyScheduler ¶ added in v1.1.0
func (*DailyScheduler) String ¶ added in v1.1.0
func (s *DailyScheduler) String() string
func (*DailyScheduler) UIText ¶ added in v1.1.0
func (s *DailyScheduler) UIText() string
type Event ¶
type Event struct { *linebot.Event Status *ConversationStatus }
func (*Event) ConversationID ¶
func (e *Event) ConversationID() ConversationID
ConversationID returns conversation ID.
func (*Event) FilterText ¶
FilterText returns true if Event.Message contains target text.
func (*Event) HandleTypeMessage ¶
func (*Event) HandleTypePostback ¶
func (*Event) ReadTextLines ¶
ReadTextLines reads text lines from Event.Message and trim spaces per line.
func (*Event) SetStatus ¶ added in v1.2.5
func (e *Event) SetStatus(st ConversationStatusType)
type Executor ¶ added in v1.1.0
type Executor struct {
Type ExecutorType
}
type ExecutorType ¶ added in v1.1.0
type ExecutorType int
const (
ExecutorTypeShoppingList ExecutorType = iota + 1
)
func (ExecutorType) String ¶ added in v1.1.0
func (t ExecutorType) String() string
func (ExecutorType) UIText ¶ added in v1.1.0
func (t ExecutorType) UIText() string
type Item ¶
type Item struct { Indexes []int Name []string Action ActionType }
func (*Item) UniqueIndexes ¶
type OneshotScheduler ¶ added in v1.1.0
func (*OneshotScheduler) String ¶ added in v1.1.0
func (s *OneshotScheduler) String() string
func (*OneshotScheduler) UIText ¶ added in v1.1.0
func (s *OneshotScheduler) UIText() string
type ReminderItem ¶ added in v1.1.0
type ReminderItem struct { ID ReminderItemID ConversationID ConversationID Scheduler Scheduler Executor *Executor }
func NewReminderItem ¶ added in v1.2.6
func NewReminderItem(conversationID ConversationID, scheduler Scheduler, executor *Executor) *ReminderItem
func (ReminderItem) IDJSON ¶ added in v1.1.0
func (r ReminderItem) IDJSON() *ReminderItemIDJSON
type ReminderItemID ¶ added in v1.1.0
type ReminderItemID string
type ReminderItemIDJSON ¶ added in v1.1.0
type ReminderItems ¶ added in v1.1.0
type ReminderItems []*ReminderItem
func (ReminderItems) FilterNextSchedule ¶ added in v1.1.0
func (l ReminderItems) FilterNextSchedule(t time.Time, d time.Duration) ReminderItems
func (ReminderItems) Print ¶ added in v1.1.0
func (l ReminderItems) Print(typ ListType) string
type ReminderReplyType ¶ added in v1.1.0
type ReminderReplyType int
const ( ReminderReplyTypeAll ReminderReplyType = iota ReminderReplyTypeEmptyList )
type Scheduler ¶ added in v1.1.0
type Scheduler interface { // String returns a serialized schedule settings. String() string // UIText returns a text for UI. UIText() string // Next returns next scheduled time or ErrEndSchedule. Next(t time.Time) (time.Time, error) }
func ParseScheduler ¶ added in v1.1.0
type ShoppingItem ¶
type ShoppingItem struct { ID string Name string Quantity int ConversationID ConversationID CreatedAt int64 Order int }
func NewShoppingItem ¶ added in v1.2.11
func NewShoppingItem(conversationID ConversationID, name string, quantity, order int, createdAt time.Time) *ShoppingItem
func (*ShoppingItem) Validate ¶
func (m *ShoppingItem) Validate() error
type ShoppingItems ¶
type ShoppingItems []*ShoppingItem
func (ShoppingItems) FilterByNames ¶
func (l ShoppingItems) FilterByNames(names []string) ShoppingItems
func (ShoppingItems) Print ¶
func (l ShoppingItems) Print(typ ListType) string
type ShoppingReplyType ¶
type ShoppingReplyType int
const ( ShoppingReplyTypeAll ShoppingReplyType = iota ShoppingReplyTypeEmptyList ShoppingReplyTypeWithoutView )
Click to show internal directories.
Click to hide internal directories.