public DateTimeOffset? GetExpiration(Response response) { if (!IsCachableResponse(response)) { return null; } var headerValue = response.Headers[CacheControlKey]; if (!IsCachableHeaderValue(headerValue)) { return null; } var cacheDuration = CacheControlHeaderValue(headerValue); if (cacheDuration == 0) { return null; } return DateTimeOffset.UtcNow.AddSeconds(cacheDuration); }
public OAuthException(Response response) : base (response.Body, response) { }
public InputParameterException(string message, Response response, ErrorCode errorCode) : base(message, response, errorCode) { }
public NonXmlResponseException(string message, Exception innerException, Response response) : base(message, innerException, response) { }
public NonXmlResponseException(Response response) : base(DEFAULT_ERROR_MESSAGE, response) { }
public UserCardException(string message, Response response, ErrorCode errorCode) : base(message, response, errorCode) { }
public InvalidResourceException(string message, Response response, ErrorCode errorCode) : base(message, response, errorCode) { }
public RemoteApiException(string message, Response response, ErrorCode errorCode) : base(message, response, errorCode) { }
public UnrecognisedErrorException(string message, Exception innerException, Response response) : base(message, innerException, response) { }
public UnrecognisedErrorException(Exception innerException, Response response) : base(DEFAULT_ERROR_MESSAGE, innerException, response) { }
public UnexpectedXmlResponseException(Exception inner, Response response): base(DEFAULT_ERROR_MESSAGE, inner, response) { }
private bool IsCachableResponse(Response response) { return (response.OriginalRequest.Method == HttpMethod.Get) && (response.Headers.ContainsKey(CacheControlKey)); }
public FakeHttpClient(Response fakeResponse) { _fakeResponse = fakeResponse; }
protected ApiErrorException(string message, Response response, ErrorCode errorCode) : base(message, response) { ErrorCode = errorCode; }
public UnrecognisedStatusException(Response response) : base(DEFAULT_ERROR_MESSAGE, response) { }