summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/api/trello.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/internal/api/trello.go b/internal/api/trello.go
index be5d81b..91d6d66 100644
--- a/internal/api/trello.go
+++ b/internal/api/trello.go
@@ -64,9 +64,13 @@ type trelloListResponse struct {
// GetBoards fetches all boards for the authenticated user
func (c *TrelloClient) GetBoards(ctx context.Context) ([]models.Board, error) {
- url := fmt.Sprintf("%s/members/me/boards?key=%s&token=%s&filter=open", c.baseURL, c.apiKey, c.token)
+ params := url.Values{}
+ params.Set("key", c.apiKey)
+ params.Set("token", c.token)
+ params.Set("filter", "open")
- req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
+ reqURL := fmt.Sprintf("%s/members/me/boards?%s", c.baseURL, params.Encode())
+ req, err := http.NewRequestWithContext(ctx, "GET", reqURL, nil)
if err != nil {
return nil, fmt.Errorf("failed to create request: %w", err)
}
@@ -103,9 +107,13 @@ func (c *TrelloClient) GetBoards(ctx context.Context) ([]models.Board, error) {
// GetCards fetches all cards for a specific board
func (c *TrelloClient) GetCards(ctx context.Context, boardID string) ([]models.Card, error) {
- url := fmt.Sprintf("%s/boards/%s/cards?key=%s&token=%s&filter=visible", c.baseURL, boardID, c.apiKey, c.token)
+ params := url.Values{}
+ params.Set("key", c.apiKey)
+ params.Set("token", c.token)
+ params.Set("filter", "visible")
- req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
+ reqURL := fmt.Sprintf("%s/boards/%s/cards?%s", c.baseURL, boardID, params.Encode())
+ req, err := http.NewRequestWithContext(ctx, "GET", reqURL, nil)
if err != nil {
return nil, fmt.Errorf("failed to create request: %w", err)
}
@@ -163,9 +171,12 @@ func (c *TrelloClient) GetCards(ctx context.Context, boardID string) ([]models.C
// getLists fetches lists for a board
func (c *TrelloClient) getLists(ctx context.Context, boardID string) ([]models.List, error) {
- url := fmt.Sprintf("%s/boards/%s/lists?key=%s&token=%s", c.baseURL, boardID, c.apiKey, c.token)
+ params := url.Values{}
+ params.Set("key", c.apiKey)
+ params.Set("token", c.token)
- req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
+ reqURL := fmt.Sprintf("%s/boards/%s/lists?%s", c.baseURL, boardID, params.Encode())
+ req, err := http.NewRequestWithContext(ctx, "GET", reqURL, nil)
if err != nil {
return nil, fmt.Errorf("failed to create request: %w", err)
}