Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
notification.go1.66 kB
package notification import ( "time" "github.com/rs/xid" "github.com/Southclaws/opt" "github.com/Southclaws/storyden/app/resources/datagraph" "github.com/Southclaws/storyden/app/resources/profile" "github.com/Southclaws/storyden/internal/ent" ) type Notification struct { ID xid.ID Event Event Item datagraph.Item Source opt.Optional[profile.Ref] Time time.Time Read bool } type Notifications []*Notification func (a Notifications) Len() int { return len(a) } func (a Notifications) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a Notifications) Less(i, j int) bool { return a[i].Time.After(a[j].Time) } type NotificationRef struct { ID xid.ID Event Event ItemRef opt.Optional[datagraph.Ref] Source opt.Optional[profile.Ref] Time time.Time Read bool } type NotificationRefs []*NotificationRef func Map(r *ent.Notification) (*NotificationRef, error) { sourceEdge := opt.NewPtr(r.Edges.Source) source, err := opt.MapErr(sourceEdge, func(a ent.Account) (profile.Ref, error) { p, err := profile.MapRef(&a) if err != nil { return profile.Ref{}, err } return *p, err }) if err != nil { return nil, err } et, err := NewEvent(r.EventType) if err != nil { return nil, err } var itemRef opt.Optional[datagraph.Ref] if r.DatagraphKind != nil && r.DatagraphID != nil { k, err := datagraph.NewKind(*r.DatagraphKind) if err != nil { return nil, err } itemRef = opt.New(datagraph.Ref{ID: *r.DatagraphID, Kind: k}) } return &NotificationRef{ ID: r.ID, Event: et, ItemRef: itemRef, Source: source, Time: r.CreatedAt, Read: r.Read, }, nil }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server