- Go web server using Gin framework - Proxy FRED economic data API - Support series, observations, search, releases endpoints
106 lines
3.7 KiB
Go
106 lines
3.7 KiB
Go
package models
|
|
|
|
type Series struct {
|
|
ID string `json:"id"`
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
Title string `json:"title"`
|
|
ObservationStart string `json:"observation_start"`
|
|
ObservationEnd string `json:"observation_end"`
|
|
Frequency string `json:"frequency"`
|
|
FrequencyShort string `json:"frequency_short"`
|
|
Units string `json:"units"`
|
|
UnitsShort string `json:"units_short"`
|
|
SeasonalAdjustment string `json:"seasonal_adjustment"`
|
|
SeasonalAdjustmentShort string `json:"seasonal_adjustment_short"`
|
|
LastUpdated string `json:"last_updated"`
|
|
Popularity int `json:"popularity"`
|
|
Notes string `json:"notes,omitempty"`
|
|
}
|
|
|
|
type SeriesListResponse struct {
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
Seriess []Series `json:"seriess"`
|
|
}
|
|
|
|
type Observation struct {
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
Date string `json:"date"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
type ObservationsResponse struct {
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
ObservationStart string `json:"observation_start"`
|
|
ObservationEnd string `json:"observation_end"`
|
|
Units string `json:"units"`
|
|
OutputType int `json:"output_type"`
|
|
FileType string `json:"file_type"`
|
|
OrderBy string `json:"order_by"`
|
|
SortOrder string `json:"sort_order"`
|
|
Count int `json:"count"`
|
|
Offset int `json:"offset"`
|
|
Limit int `json:"limit"`
|
|
Observations []Observation `json:"observations"`
|
|
}
|
|
|
|
type SearchResult struct {
|
|
ID string `json:"id"`
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
Title string `json:"title"`
|
|
Frequency string `json:"frequency"`
|
|
Units string `json:"units"`
|
|
}
|
|
|
|
type SearchResponse struct {
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
Count int `json:"count"`
|
|
Offset int `json:"offset"`
|
|
Limit int `json:"limit"`
|
|
OrderBy string `json:"order_by"`
|
|
SortOrder string `json:"sort_order"`
|
|
Results []SearchResult `json:"seriess"`
|
|
}
|
|
|
|
type Release struct {
|
|
ID int `json:"id"`
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
Link string `json:"link"`
|
|
Name string `json:"name"`
|
|
PressRelease bool `json:"press_release"`
|
|
Notes string `json:"notes,omitempty"`
|
|
}
|
|
|
|
type ReleasesResponse struct {
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
Count int `json:"count"`
|
|
Offset int `json:"offset"`
|
|
Limit int `json:"limit"`
|
|
Releases []Release `json:"releases"`
|
|
}
|
|
|
|
type ReleaseDatesResponse struct {
|
|
RealtimeStart string `json:"realtime_start"`
|
|
RealtimeEnd string `json:"realtime_end"`
|
|
Count int `json:"count"`
|
|
Offset int `json:"offset"`
|
|
Limit int `json:"limit"`
|
|
ReleaseDates []struct {
|
|
ReleaseID int `json:"release_id"`
|
|
Date string `json:"date"`
|
|
ReleaseName string `json:"release_name"`
|
|
} `json:"release_dates"`
|
|
}
|
|
|
|
type ErrorResponse struct {
|
|
ErrorCode string `json:"error_code"`
|
|
ErrorMessage string `json:"error_message"`
|
|
}
|