Skip to content

Commit

Permalink
feat(api/badge): update badge
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Apr 17, 2024
1 parent 048ead7 commit 8aa12e0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/api/badge.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package api
import (
"bytes"
"context"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"

"github.com/go-faster/errors"
Expand All @@ -28,16 +28,17 @@ func generateBadgePath(name, text, style string) string {
}

func (s Server) GetTelegramGoTDBadge(ctx context.Context) (oas.GetTelegramGoTDBadgeOK, error) {
members := 236 + 234 + 15
_ = s.tg // TODO(ernado): fetch actual data.
var (
message = "tg"
members = 236 + 234 + 15
)
u := &url.URL{
Scheme: "https",
Host: "img.shields.io",
Path: generateBadgePath(message, fmt.Sprintf("%d members", members), "blue"),
Path: generateBadgePath(strconv.Itoa(members), "members", "179cde"),
}
q := u.Query()
q.Set("logo", "telegram")
u.RawQuery = q.Encode()

req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), http.NoBody)
if err != nil {
return oas.GetTelegramGoTDBadgeOK{}, errors.Wrap(err, "create request")
Expand Down

0 comments on commit 8aa12e0

Please sign in to comment.