env working but auth not yet

This commit is contained in:
2025-08-28 14:43:18 -07:00
parent 05eb95304e
commit 5f27c27444
5 changed files with 81 additions and 95 deletions

View File

@@ -2,9 +2,27 @@ package api
import (
"encoding/json"
"fmt"
"time"
)
// APIError represents an error returned by the API
type APIError struct {
StatusCode int
Message string
}
func (e *APIError) Error() string {
return fmt.Sprintf("API request failed with status %d: %s", e.StatusCode, e.Message)
}
// Error types for API responses
type ErrNotFound struct{}
func (e ErrNotFound) Error() string { return "resource not found" }
type ErrBadRequest struct{}
func (e ErrBadRequest) Error() string { return "bad request" }
// Time represents a Garmin Connect time value
type Time time.Time
@@ -74,4 +92,4 @@ type BodyComposition struct {
type BodyCompositionRequest struct {
StartDate Time `json:"startDate"`
EndDate Time `json:"endDate"`
}
}