Documentation
¶
Index ¶
Constants ¶
const CouldNotUnmarshalResponseBytes = "Could not unmarshal reponseBytes. %v"
CouldNotUnmarshalResponseBytes is a string constant saying could not unmarshal responseBytes.
const ErrorWasNotNil = "Error was not nil, %v"
ErrorWasNotNil is a string constant for unit testing.
const FailureMarshaling = "Failure Marshalling: %v"
FailureMarshaling is a string constant saying Failure Marshalling.
const NilError = "error is nil"
NilError is a string constant for unit testing.
const NilID = "nil id"
NilID is a string constant saying nil id.
const ResponseWasNotAsExpected = "Response was not as expected"
ResponseWasNotAsExpected is a string constant for unit testing.
const WrongErrorText = "Wrong error text: %s"
WrongErrorText is a string constant for unit testing.
Variables ¶
var ( // Client is an implementation of HTTP Client for making calls with Do. Client HTTPClient // CachingClientVar is an implementation of the caching interface for whichever caching implementation is used. CachingClientVar CachingClient )
Functions ¶
func EsiTTLToMillis ¶ added in v0.0.2
EsiTTLToMillis takes in a context for tracing purposes and a RFC1123 time for conversion to millis for TTL. This is done by taking the current time and subtracting the inbound time to get the millis until the TTL should occur.
Types ¶
type CachingClient ¶
type CachingClient interface { AddToCache(ctx context.Context, key string, value []byte, ttl int64) CheckCache(ctx context.Context, key string) (bool, []byte) }
CachingClient is an interface for the caching package for mocking during Unit Tests
type HTTPClient ¶
HTTPClient is an interface for the http Do method for mocking during Unit Tests.
type RestHelperClient ¶
type RestHelperClient struct { }
RestHelperClient is the client making cached REST calls.
func (*RestHelperClient) MakeCachingRESTCall ¶
func (r *RestHelperClient) MakeCachingRESTCall(ctx context.Context, baseURL string, verb string, body bytes.Buffer, additionalQueryParams []configuration.KeyValue, redisQueryKey string) ([]byte, http.Header, error)
MakeCachingRESTCall takes in a context for tracing, the baseURL is the url minus query parameters, verb is the http verb in string form, body is a byte buffer of a JSON body to be sent, additionalQueryParams are the query params beyond the default ones to be sent, redisQueryKey is the unique query key by which the response will be saved and retrieved from the cache.