mirror of
https://github.com/sstent/go-garminconnect.git
synced 2026-02-02 04:21:42 +00:00
env working but auth not yet
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user