Documentation
¶
Index ¶
- Constants
- type Notification
- type Permalinker
- type PostSource
- type RawPost
- type UseCase
- func (uc *UseCase) All(ctx context.Context) ([]Notification, error)
- func (uc *UseCase) ByLongread(ctx context.Context) (map[int][]Notification, error)
- func (uc *UseCase) ForCourse(ctx context.Context, courseID int) ([]Notification, error)
- func (uc *UseCase) ForLongread(ctx context.Context, longreadID int) ([]Notification, error)
- func (uc *UseCase) WithPermalinker(p Permalinker) *UseCase
Constants ¶
View Source
const ( KindNewTask = "task_new" KindGraded = "task_graded" KindRecording = "recording" KindOther = "other" )
Kind enumerates the bot post headers we recognize.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notification ¶
type Notification struct {
PostID string
PostURL string // mm permalink, if available
PostedAt time.Time
Kind string
Title string // link title or first non-header line
Excerpt string // short snippet of the message
CourseID int // 0 if not parseable
ThemeID int
LongreadID int
LMSURL string // the linked LMS URL, if any
}
Notification is a structured view of one bot message linking back to LMS content.
type Permalinker ¶
Permalinker turns a post ID into a chat permalink. Optional.
type PostSource ¶
PostSource hands back the post stream to scan.
type UseCase ¶
type UseCase struct {
// contains filtered or unexported fields
}
UseCase wraps a PostSource with notification extraction + indexing.
func New ¶
func New(src PostSource) *UseCase
func (*UseCase) All ¶
func (uc *UseCase) All(ctx context.Context) ([]Notification, error)
All returns every parsed notification, newest first.
func (*UseCase) ByLongread ¶
ByLongread indexes every notification by its LongreadID (skipping zero IDs).
func (*UseCase) ForLongread ¶
ForLongread filters notifications by LMS longread ID.
func (*UseCase) WithPermalinker ¶
func (uc *UseCase) WithPermalinker(p Permalinker) *UseCase
Click to show internal directories.
Click to hide internal directories.