Documentation
¶
Index ¶
- func GetCacheAndStaleness(cacheFilename string, cacheTTLOverride time.Duration, allowCacheUpdate bool) (string, bool, error)
- func GetCacheAndStalenessReturnStruct(cacheFilename string, cacheTTLOverride time.Duration, allowCacheUpdate bool, ...) (string, bool, error)
- func WriteStringToCacheFile(filename string, value string) error
- func WriteStructToCacheFile(filename string, rawStruct interface{}) error
- type Response
- func BasicHttpRequest(httpMethod string, url string) (Response, error)
- func BasicHttpRequestReturnStruct(httpMethod string, url string, target interface{}) (Response, error)
- func HttpRequest(httpMethod string, url string, headers map[string][]string, ...) (Response, error)
- func HttpRequestReturnStruct(httpMethod string, url string, headers map[string][]string, ...) (Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCacheAndStaleness ¶ added in v1.1.0
func GetCacheAndStaleness(cacheFilename string, cacheTTLOverride time.Duration, allowCacheUpdate bool) (string, bool, error)
GetCacheAndStaleness returns the contents of the cache file and whether or not the cache is stale (this does not make an HTTP request)
func GetCacheAndStalenessReturnStruct ¶ added in v1.1.0
func GetCacheAndStalenessReturnStruct(cacheFilename string, cacheTTLOverride time.Duration, allowCacheUpdate bool, target interface{}) (string, bool, error)
GetCacheAndStalenessReturnStruct is the same as GetCacheAndStaleness but it returns the result as a specified struct. GetCacheAndStalenessReturnStruct returns the contents of the cache file as a struct and whether or not the cache is stale (this does not make an HTTP request)
func WriteStringToCacheFile ¶ added in v1.1.0
func WriteStructToCacheFile ¶ added in v1.1.0
Types ¶
type Response ¶
func BasicHttpRequest ¶
BasicHttpRequest makes a request with default parameters
func BasicHttpRequestReturnStruct ¶
func BasicHttpRequestReturnStruct(httpMethod string, url string, target interface{}) (Response, error)
BasicHttpRequestReturnStruct makes a request with default parameters
func HttpRequest ¶
func HttpRequest(httpMethod string, url string, headers map[string][]string, cacheTTLOverride time.Duration, allowCacheUpdate bool) (Response, error)
HttpRequest sends an HTTP request to the specified URL and returns the HTTP response. The response is cached for a duration specified by cacheTTL. If cacheTTLOverride is zero, the default cache TTL value is used.
func HttpRequestReturnStruct ¶
func HttpRequestReturnStruct(httpMethod string, url string, headers map[string][]string, cacheTTLOverride time.Duration, allowCacheUpdate bool, target interface{}) (Response, error)
HttpRequestReturnStruct is the same as HttpRequest but it returns the result as a specified struct. HttpRequest sends an HTTP request to the specified URL and returns the HTTP response. The response is cached for a duration specified by cacheTTL. If cacheTTLOverride is zero, the default cache TTL value is used.