Files
weatherapi/internal/core/ports/ports.go
Eric Rakestraw cb316c228a
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
Added a /conditions/current endpoint with computed best-guess values for current conditions
2026-03-17 15:51:00 -05:00

95 lines
2.8 KiB
Go

package ports
import (
"context"
"time"
)
type ObservationCurrentConditionsMetric struct {
TemperatureC *float64
ApparentTemperatureC *float64
DewpointC *float64
RelativeHumidity *float64
WindSpeedKmh *float64
WindDirectionDegrees *float64
ConditionCode *int
IsDay *bool
}
type ObservationPresentWeatherMetric struct {
Raw map[string]any
}
type ObservationRecordMetric struct {
EventID string
StationID *string
StationName *string
Timestamp time.Time
ConditionCode int
IsDay *bool
TextDescription *string
TemperatureC *float64
DewpointC *float64
WindDirectionDegrees *float64
WindSpeedKmh *float64
WindGustKmh *float64
BarometricPressurePa *float64
VisibilityMeters *float64
RelativeHumidityPercent *float64
ApparentTemperatureC *float64
PresentWeather []ObservationPresentWeatherMetric
}
type ForecastPeriodMetric struct {
PeriodIndex int
StartTime time.Time
EndTime time.Time
Name *string
IsDay *bool
ConditionCode int
ConditionText *string
ProviderRawDescription *string
TextDescription *string
DetailedText *string
IconURL *string
TemperatureC *float64
TemperatureCMin *float64
TemperatureCMax *float64
DewpointC *float64
RelativeHumidityPercent *float64
WindDirectionDegrees *float64
WindSpeedKmh *float64
WindGustKmh *float64
BarometricPressurePa *float64
VisibilityMeters *float64
ApparentTemperatureC *float64
CloudCoverPercent *float64
ProbabilityOfPrecipitationPercent *float64
PrecipitationAmountMm *float64
SnowfallDepthMm *float64
UVIndex *float64
}
type AlertRecord struct {
Effective *time.Time
Expires *time.Time
Severity *string
Event *string
Headline *string
Instruction *string
Description *string
}
type ObservationRepository interface {
GetCurrentConditionsSummary(ctx context.Context, window time.Duration) (ObservationCurrentConditionsMetric, error)
ListRecentObservations(ctx context.Context, count int) ([]ObservationRecordMetric, error)
}
type ForecastRepository interface {
ListForecastPeriodsAt(ctx context.Context, ts time.Time, limit int) ([]ForecastPeriodMetric, error)
}
type AlertRepository interface {
ListCurrentAlerts(ctx context.Context) ([]AlertRecord, error)
}