retrieve API usage limits; rename Statistics() to GetUserStatistics();

This commit is contained in:
2013-10-25 00:52:29 +02:00
parent 8bce874504
commit a1f6637e9d
5 changed files with 136 additions and 2 deletions
+15
View File
@@ -22,6 +22,11 @@ namespace PocketSharp
/// </summary>
protected readonly HttpClient _restClient;
/// <summary>
/// Caches HTTP headers from last response
/// </summary>
private HttpResponseHeaders lastHeaders;
/// <summary>
/// The base URL for the Pocket API
/// </summary>
@@ -54,6 +59,7 @@ namespace PocketSharp
public string AccessCode { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PocketClient"/> class.
/// </summary>
@@ -144,6 +150,9 @@ namespace PocketSharp
// validate HTTP response
ValidateResponse(response);
// cache headers
lastHeaders = response.Headers;
// read response
var responseString = await response.Content.ReadAsStringAsync();
@@ -267,6 +276,11 @@ namespace PocketSharp
{
string result = null;
if (headers == null || String.IsNullOrEmpty(key))
{
return null;
}
foreach (var header in headers)
{
if (header.Key == key)
@@ -275,6 +289,7 @@ namespace PocketSharp
headerEnumerator.MoveNext();
result = headerEnumerator.Current;
break;
}
}