model

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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
)

type Event

type Event linebot.Event

func (*Event) ConversationID

func (e *Event) ConversationID() ConversationID

ConversationID returns conversation ID.

func (*Event) FilterText

func (e *Event) FilterText(target string) bool

FilterText returns true if Event.Message contains target text.

func (*Event) HandleTypeMessage

func (e *Event) HandleTypeMessage(ctx context.Context, f func(context.Context, *Event) error) error

func (*Event) HandleTypePostback

func (e *Event) HandleTypePostback(ctx context.Context, f func(context.Context, *Event) error) error

func (*Event) ReadTextLines

func (e *Event) ReadTextLines() []string

ReadTextLines reads text lines from Event.Message and trim spaces per line.

type Item

type Item struct {
	Indexes []int
	Name    []string
	Action  ActionType
}

func (*Item) UniqueIndexes

func (i *Item) UniqueIndexes() []int

type ListType

type ListType int
const (
	ListTypeDotted ListType = iota
	ListTypeOrdered
)

type ShoppingItem

type ShoppingItem struct {
	ID             string
	Name           string
	Quantity       int
	ConversationID ConversationID
	CreatedAt      int64
	Order          int
}

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
)

Jump to

Keyboard shortcuts

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