Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
asset.go1.07 kB
package asset import ( "github.com/Southclaws/opt" "github.com/rs/xid" "github.com/Southclaws/storyden/internal/ent" "github.com/Southclaws/storyden/internal/mime" ) type AssetID = xid.ID func NewID() AssetID { return AssetID(xid.New()) } type Asset struct { ID AssetID Name Filename Size int MIME mime.Type Metadata Metadata Parent opt.Optional[Asset] } func Map(a *ent.Asset) *Asset { parent := opt.NewPtrMap(a.Edges.Parent, func(a ent.Asset) Asset { return *Map(&a) }) return &Asset{ ID: AssetID(a.ID), Name: Filename{ id: opt.New(a.ID), name: a.Filename, hasID: true, }, Size: a.Size, MIME: mime.New(a.MimeType), Metadata: a.Metadata, Parent: parent, } } type Metadata map[string]any func (m Metadata) GetWidth() float64 { v, ok := m["width"] if !ok { return 0.0 } s, ok := v.(float64) if !ok { return 0.0 } return s } func (m Metadata) GetHeight() float64 { v, ok := m["height"] if !ok { return 0.0 } s, ok := v.(float64) if !ok { return 0.0 } return s }

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