2016-11-11 14:14:38 +01:00
|
|
|
package endpoints
|
2016-10-23 10:42:06 +02:00
|
|
|
|
|
|
|
type TimeInfo struct {
|
|
|
|
Date string `json:"date"`
|
|
|
|
TimezoneType string `json:"timezone_type"`
|
|
|
|
Timezone string `json:"timezone"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type CacheStatus struct {
|
|
|
|
OrigTTL int `json:"orig_ttl"`
|
|
|
|
CachedAt TimeInfo `json:"cached_at"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type APIInfo struct {
|
|
|
|
Version string
|
|
|
|
ResultFromCache bool `json:"result_from_cache"`
|
|
|
|
CacheStatus CacheStatus `json:"cache_status"`
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:12:02 +01:00
|
|
|
// go generate does not work in subdirectories. Beautious.
|
|
|
|
var VERSION string
|
|
|
|
|
2016-11-11 17:33:33 +01:00
|
|
|
func GetApiInfo(from_cache bool) *APIInfo {
|
2016-10-23 10:42:06 +02:00
|
|
|
ai := &APIInfo{}
|
|
|
|
|
2017-01-26 12:12:02 +01:00
|
|
|
ai.Version = VERSION
|
2016-11-11 17:47:51 +01:00
|
|
|
ai.ResultFromCache = from_cache
|
2016-10-23 10:42:06 +02:00
|
|
|
|
|
|
|
return ai
|
|
|
|
}
|