Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
report.go2 kB
package report import ( "time" "github.com/Southclaws/opt" "github.com/rs/xid" "github.com/Southclaws/storyden/app/resources/account" "github.com/Southclaws/storyden/app/resources/datagraph" "github.com/Southclaws/storyden/internal/ent" ) type ID xid.ID func (i ID) String() string { return xid.ID(i).String() } type Report struct { ID ID CreatedAt time.Time UpdatedAt time.Time Status Status TargetItemKind datagraph.Kind TargetItemID xid.ID TargetItem datagraph.Item ReportedBy account.Account HandledBy opt.Optional[account.Account] Comment opt.Optional[string] } type Reports []*Report func (a Reports) Len() int { return len(a) } func (a Reports) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a Reports) Less(i, j int) bool { return a[i].CreatedAt.After(a[j].CreatedAt) } type ReportRef struct { ID ID CreatedAt time.Time UpdatedAt time.Time Status Status TargetRef datagraph.Ref ReportedBy account.Account HandledBy opt.Optional[account.Account] Comment opt.Optional[string] } type ReportRefs []*ReportRef func Map(r *ent.Report) (*ReportRef, error) { reportedBy, err := account.MapRef(r.Edges.ReportedBy) if err != nil { return nil, err } handledByEdge := opt.NewPtr(r.Edges.HandledBy) handledBy, err := opt.MapErr(handledByEdge, func(a ent.Account) (account.Account, error) { p, err := account.MapRef(&a) if err != nil { return account.Account{}, err } return *p, nil }) if err != nil { return nil, err } status, err := NewStatus(r.Status) if err != nil { return nil, err } targetKind, err := datagraph.NewKind(r.TargetKind) if err != nil { return nil, err } return &ReportRef{ ID: ID(r.ID), CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt, TargetRef: datagraph.Ref{ ID: r.TargetID, Kind: targetKind, }, Status: status, ReportedBy: *reportedBy, HandledBy: handledBy, Comment: opt.NewPtr(r.Comment), }, 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