package service import ( "context" "fmt" "gitea.dwysokinski.me/twhelp/dcbot/internal/domain" ) type Choice struct { client TWHelpClient } func NewChoice(client TWHelpClient) *Choice { return &Choice{client: client} } func (c *Choice) Versions(ctx context.Context) ([]domain.Choice, error) { versions, err := c.client.ListVersions(ctx) if err != nil { return nil, fmt.Errorf("TWHelpClient.ListVersions: %w", 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 }