Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
follow_writer.go1.1 kB
package follow_writer import ( "context" "github.com/Southclaws/fault" "github.com/Southclaws/fault/fctx" "github.com/rs/xid" "github.com/Southclaws/storyden/app/resources/account" "github.com/Southclaws/storyden/internal/ent" "github.com/Southclaws/storyden/internal/ent/accountfollow" ) type Writer struct { db *ent.Client } func New(db *ent.Client) *Writer { return &Writer{db} } func (w *Writer) Follow(ctx context.Context, follower, following account.AccountID) error { err := w.db.AccountFollow.Create(). SetFollowerAccountID(xid.ID(follower)). SetFollowingAccountID(xid.ID(following)). Exec(ctx) if err != nil { if ent.IsConstraintError(err) { return nil } return fault.Wrap(err, fctx.With(ctx)) } return nil } func (w *Writer) Unfollow(ctx context.Context, follower, following account.AccountID) error { _, err := w.db.AccountFollow.Delete(). Where( accountfollow.FollowerAccountID(xid.ID(follower)), accountfollow.FollowingAccountID(xid.ID(following)), ). Exec(ctx) if err != nil { return fault.Wrap(err, fctx.With(ctx)) } return 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