package service import ( "context" "gitea.dwysokinski.me/twhelp/dcbot/internal/domain" ) type Choice struct { twhelpSvc TWHelpService } func NewChoice(twhelpSvc TWHelpService) *Choice { return &Choice{twhelpSvc: twhelpSvc} } func (c *Choice) Versions(ctx context.Context) ([]domain.Choice, error) { versions, err := c.twhelpSvc.ListVersions(ctx) if err != nil { return nil, err } choices := make([]domain.Choice, 0, len(versions)) for _, v := range versions { choices = append(choices, domain.Choice{ Name: v.Host, Value: v.Code, }) } return choices, nil }