Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a08adef45 | |||
| abfb9f6d78 | |||
| a1f6637e9d | |||
| 8bce874504 | |||
| 50ee8905c5 | |||
| 4d2650072f | |||
| 65e31ac2e2 | |||
| 456c4f17f2 | |||
| ee1e32b9ab | |||
| 9d677eea5a | |||
| 64098518fa | |||
| cc6aab227d | |||
| 543b3e8191 | |||
| 2186561fd8 | |||
| 8650883975 | |||
| 6ede86c367 | |||
| d373bdd9bf | |||
| b4ae55d8ab | |||
| aae43cf00d |
@@ -1,3 +1,16 @@
|
||||
### 2.1.0 (2013-10-25)
|
||||
|
||||
- Rename `Statistics()` to `GetUserStatistics()`
|
||||
- Made `CallbackUri` public (thanks to @ScottIsAFool)
|
||||
- Added Fody/PropertyChanged (thanks to @ScottIsAFool)
|
||||
- Method `GetUsageLimits()` to retrieve API usage limits
|
||||
- Add PORTABLE constant to SgmlReader
|
||||
|
||||
### 2.0.1 (2013-10-19)
|
||||
|
||||
- Catch HttpRequestExceptions and provide as InnerException for PocketException
|
||||
- Read Article from URI (method overload)
|
||||
|
||||
### 2.0.0 (2013-10-17)
|
||||
|
||||
- Add Reader API _(does not use the official Article View API, which is private. The PocketReader is based on a custom PCL port of NReadability and SgmlReader)_
|
||||
|
||||
@@ -151,5 +151,14 @@ namespace PocketSharp.Tests
|
||||
|
||||
Assert.True(statistics.CountAll > 0);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task AreLimitsRetrieved()
|
||||
{
|
||||
PocketLimits limits = await client.GetUsageLimits();
|
||||
|
||||
Assert.True(limits.RateLimitForConsumerKey > 9999);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<p class="app-description">
|
||||
PocketSharp is a C#.NET class library, that integrates the Pocket API v3
|
||||
<br><br>
|
||||
Current version: <b>2.0.0</b><br>
|
||||
Current version: <b>2.0.1</b><br>
|
||||
<a href="https://www.nuget.org/packages/PocketSharp/">@ nuget</a>
|
||||
</p>
|
||||
<div class="app-nuget">
|
||||
@@ -126,6 +126,7 @@ using PocketSharp.Models;</code></pre>
|
||||
|
||||
<h2>Release History</h2>
|
||||
<ul>
|
||||
<li><b>2.0.1</b> (2013-10-19) Catch HttpRequestExceptions and provide as InnerException for PocketException + Read Article from URI (method overload)</li>
|
||||
<li><b>2.0.0</b> (2013-10-17) Add Reader API</li>
|
||||
<li><b>1.5.1</b> (2013-09-30) <code>RetrieveFilter.All</code> didn't work; improve search speed</li>
|
||||
<li><b>1.5.0</b> (2013-09-28) add statistics and registration API</li>
|
||||
|
||||
@@ -48,6 +48,7 @@ Global
|
||||
{817200C3-A327-4E35-9B5F-63A51C088577}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{775569C2-987F-4AC4-8BA5-A315A21ED1B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
||||
@@ -11,13 +11,22 @@ namespace PocketSharp
|
||||
/// </summary>
|
||||
public partial class PocketClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves items from pocket
|
||||
/// with the given filters
|
||||
/// </summary>
|
||||
/// <param name="parameters">parameters, which are mapped to the officials from http://getpocket.com/developer/docs/v3/retrieve </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="PocketException"></exception>
|
||||
/// <summary>
|
||||
/// Retrieves items from pocket
|
||||
/// with the given filters
|
||||
/// </summary>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <param name="favorite">The favorite.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="contentType">Type of the content.</param>
|
||||
/// <param name="sort">The sort.</param>
|
||||
/// <param name="search">The search.</param>
|
||||
/// <param name="domain">The domain.</param>
|
||||
/// <param name="since">The since.</param>
|
||||
/// <param name="count">The count.</param>
|
||||
/// <param name="offset">The offset.</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="PocketException"></exception>
|
||||
public async Task<List<PocketItem>> Get(
|
||||
State? state = null,
|
||||
bool? favorite = null,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using PocketSharp.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PocketSharp
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using PocketSharp.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
|
||||
@@ -14,9 +14,50 @@ namespace PocketSharp
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="PocketException"></exception>
|
||||
public async Task<PocketStatistics> Statistics()
|
||||
public async Task<PocketStatistics> GetUserStatistics()
|
||||
{
|
||||
return await Request<PocketStatistics>("stats");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Statistics from the user account.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="PocketException"></exception>
|
||||
[Obsolete("Please use GetUserStatistics")]
|
||||
public async Task<PocketStatistics> Statistics()
|
||||
{
|
||||
return await GetUserStatistics();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns API usage statistics.
|
||||
/// If a request was made before, the data is returned synchronously from the cache.
|
||||
/// Note: This method only works for authenticated users with a given AccessCode.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="PocketException"></exception>
|
||||
public async Task<PocketLimits> GetUsageLimits()
|
||||
{
|
||||
string rateLimitForConsumerKey = TryGetHeaderValue(lastHeaders, "X-Limit-Key-Limit");
|
||||
|
||||
if (rateLimitForConsumerKey == null)
|
||||
{
|
||||
// this is the fastest way to do a non-failing request to receive the correct headers
|
||||
await Get(count: 1);
|
||||
}
|
||||
|
||||
return new PocketLimits()
|
||||
{
|
||||
RateLimitForConsumerKey = Convert.ToInt32(TryGetHeaderValue(lastHeaders, "X-Limit-Key-Limit")),
|
||||
RemainingCallsForConsumerKey = Convert.ToInt32(TryGetHeaderValue(lastHeaders, "X-Limit-Key-Remaining")),
|
||||
SecondsUntilLimitResetsForConsumerKey = Convert.ToInt32(TryGetHeaderValue(lastHeaders, "X-Limit-Key-Reset")),
|
||||
RateLimitForUser = Convert.ToInt32(TryGetHeaderValue(lastHeaders, "X-Limit-User-Limit")),
|
||||
RemainingCallsForUser = Convert.ToInt32(TryGetHeaderValue(lastHeaders, "X-Limit-User-Remaining")),
|
||||
SecondsUntilLimitResetsForUser = Convert.ToInt32(TryGetHeaderValue(lastHeaders, "X-Limit-User-Reset"))
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Choose>
|
||||
<When Condition="$(NCrunchOriginalSolutionDir) != '' And $(NCrunchOriginalSolutionDir) != '*Undefined*'">
|
||||
<PropertyGroup>
|
||||
<FodySolutionDir>$(NCrunchOriginalSolutionDir)</FodySolutionDir>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(SolutionDir) != '' And $(SolutionDir) != '*Undefined*'">
|
||||
<PropertyGroup>
|
||||
<FodySolutionDir>$(SolutionDir)</FodySolutionDir>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">
|
||||
<PropertyGroup>
|
||||
<FodySolutionDir>$(MSBuildProjectDirectory)\..\</FodySolutionDir>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(KeyOriginatorFile) != '' And $(KeyOriginatorFile) != '*Undefined*'">
|
||||
<PropertyGroup>
|
||||
<FodyKeyFilePath>$(KeyOriginatorFile)</FodyKeyFilePath>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(AssemblyOriginatorKeyFile) != '' And $(AssemblyOriginatorKeyFile) != '*Undefined*'">
|
||||
<PropertyGroup>
|
||||
<FodyKeyFilePath>$(AssemblyOriginatorKeyFile)</FodyKeyFilePath>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<Otherwise >
|
||||
<PropertyGroup>
|
||||
<FodyKeyFilePath></FodyKeyFilePath>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<PropertyGroup>
|
||||
<IntermediateDir>$(ProjectDir)$(IntermediateOutputPath)</IntermediateDir>
|
||||
<FodyMessageImportance Condition="$(FodyMessageImportance) == '' Or $(FodyMessageImportance) == '*Undefined*'">Low</FodyMessageImportance>
|
||||
<FodySignAssembly Condition="$(FodySignAssembly) == '' Or $(FodySignAssembly) == '*Undefined*'">$(SignAssembly)</FodySignAssembly>
|
||||
<FodyPath Condition="$(FodyPath) == '' Or $(FodyPath) == '*Undefined*'">$(MSBuildThisFileDirectory)</FodyPath>
|
||||
</PropertyGroup>
|
||||
<UsingTask
|
||||
TaskName="Fody.WeavingTask"
|
||||
AssemblyFile="$(FodyPath)\Fody.dll" />
|
||||
<Target
|
||||
AfterTargets="AfterCompile"
|
||||
Name="WinFodyTarget"
|
||||
Condition=" '$(OS)' == 'Windows_NT'">
|
||||
|
||||
<Fody.WeavingTask
|
||||
AssemblyPath="@(IntermediateAssembly)"
|
||||
IntermediateDir="$(IntermediateDir)"
|
||||
KeyFilePath="$(FodyKeyFilePath)"
|
||||
MessageImportance="$(FodyMessageImportance)"
|
||||
ProjectDirectory="$(ProjectDir)"
|
||||
SolutionDir="$(FodySolutionDir)"
|
||||
References="@(ReferencePath)"
|
||||
SignAssembly="$(FodySignAssembly)"
|
||||
ReferenceCopyLocalPaths="@(ReferenceCopyLocalPaths)"
|
||||
DefineConstants="$(DefineConstants)"
|
||||
/>
|
||||
</Target>
|
||||
|
||||
<Target
|
||||
AfterTargets="AfterBuild"
|
||||
Name="NonWinFodyTarget"
|
||||
Condition=" '$(OS)' != 'Windows_NT'">
|
||||
<Fody.WeavingTask
|
||||
AssemblyPath="$(TargetPath)"
|
||||
IntermediateDir="$(IntermediateDir)"
|
||||
KeyFilePath="$(FodyKeyFilePath)"
|
||||
MessageImportance="$(FodyMessageImportance)"
|
||||
ProjectDirectory="$(ProjectDir)"
|
||||
SolutionDir="$(FodySolutionDir)"
|
||||
References="@(ReferencePath)"
|
||||
SignAssembly="$(FodySignAssembly)"
|
||||
ReferenceCopyLocalPaths="$(ReferenceCopyLocalPaths)"
|
||||
DefineConstants="$(DefineConstants)"
|
||||
/>
|
||||
</Target>
|
||||
|
||||
|
||||
<!--Support for ncrunch-->
|
||||
<ItemGroup>
|
||||
<None Include="$(FodyPath)\*.*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers>
|
||||
<PropertyChanged />
|
||||
</Weavers>
|
||||
@@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Linq;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Readable article
|
||||
/// </summary>
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketArticle
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
@@ -8,6 +8,7 @@ namespace PocketSharp.Models
|
||||
/// Author
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketAuthor
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
@@ -8,6 +8,7 @@ namespace PocketSharp.Models
|
||||
/// Image
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketImage
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
@@ -10,6 +10,7 @@ namespace PocketSharp.Models
|
||||
/// see: http://getpocket.com/developer/docs/v3/retrieve
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketItem
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
using Newtonsoft.Json;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// API Limitation Statistics
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketLimits
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the rate limit.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Rate limit for current consumer key.
|
||||
/// </value>
|
||||
[JsonProperty("X-Limit-Key-Limit")]
|
||||
public int RateLimitForConsumerKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the remaining calls.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Remaining calls for current consumer key.
|
||||
/// </value>
|
||||
[JsonProperty("X-Limit-Key-Remaining")]
|
||||
public int RemainingCallsForConsumerKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reset seconds.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Seconds until limit resets for current consumer key.
|
||||
/// </value>
|
||||
[JsonProperty("X-Limit-Key-Reset")]
|
||||
public int SecondsUntilLimitResetsForConsumerKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the rate limit.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Rate limit for current user.
|
||||
/// </value>
|
||||
[JsonProperty("X-Limit-User-Limit")]
|
||||
public int RateLimitForUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the remaining calls.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Remaining calls for current user.
|
||||
/// </value>
|
||||
[JsonProperty("X-Limit-User-Remaining")]
|
||||
public int RemainingCallsForUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reset seconds.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Seconds until limit resets for current user.
|
||||
/// </value>
|
||||
[JsonProperty("X-Limit-User-Reset")]
|
||||
public int SecondsUntilLimitResetsForUser { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
@@ -7,6 +7,7 @@ namespace PocketSharp.Models
|
||||
/// Statistics
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketStatistics
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Tag
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
public class PocketTag
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// Tag
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The name.
|
||||
/// </value>
|
||||
[JsonProperty("tag")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
[JsonObject]
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketTag
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The name.
|
||||
/// </value>
|
||||
[JsonProperty("tag")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +1,41 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Video
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
public class PocketVideo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the ID.
|
||||
/// Video
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The ID.
|
||||
/// </value>
|
||||
[JsonProperty("video_id")]
|
||||
public string ID { get; set; }
|
||||
[JsonObject]
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketVideo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the ID.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The ID.
|
||||
/// </value>
|
||||
[JsonProperty("video_id")]
|
||||
public string ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the external ID.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The external ID.
|
||||
/// </value>
|
||||
[JsonProperty("vid")]
|
||||
public string ExternalID { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the external ID.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The external ID.
|
||||
/// </value>
|
||||
[JsonProperty("vid")]
|
||||
public string ExternalID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the URI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The URI.
|
||||
/// </value>
|
||||
[JsonProperty("src")]
|
||||
public Uri Uri { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the URI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The URI.
|
||||
/// </value>
|
||||
[JsonProperty("src")]
|
||||
public Uri Uri { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
|
||||
@@ -5,9 +5,7 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace PocketSharp
|
||||
@@ -22,6 +20,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>
|
||||
@@ -35,7 +38,7 @@ namespace PocketSharp
|
||||
/// <summary>
|
||||
/// callback URL for API calls
|
||||
/// </summary>
|
||||
protected string CallbackUri { get; set; }
|
||||
public string CallbackUri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Accessor for the Pocket API key
|
||||
@@ -54,6 +57,7 @@ namespace PocketSharp
|
||||
public string AccessCode { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PocketClient"/> class.
|
||||
/// </summary>
|
||||
@@ -144,6 +148,9 @@ namespace PocketSharp
|
||||
// validate HTTP response
|
||||
ValidateResponse(response);
|
||||
|
||||
// cache headers
|
||||
lastHeaders = response.Headers;
|
||||
|
||||
// read response
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
@@ -267,6 +274,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 +287,7 @@ namespace PocketSharp
|
||||
headerEnumerator.MoveNext();
|
||||
|
||||
result = headerEnumerator.Current;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
<RootNamespace>PocketSharp</RootNamespace>
|
||||
<AssemblyName>PocketSharp</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile104</TargetFrameworkProfile>
|
||||
<TargetFrameworkProfile>Profile96</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
<FodyPath>..\packages\Fody.1.17.4.0</FodyPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -36,12 +37,14 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||
<None Include="Fody.targets" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Components\Statistics.cs" />
|
||||
<Compile Include="Models\Parameters\RegisterParameters.cs" />
|
||||
<Compile Include="Models\PocketArticle.cs" />
|
||||
<Compile Include="Models\PocketLimits.cs" />
|
||||
<Compile Include="Models\PocketStatistics.cs" />
|
||||
<Compile Include="Utilities\PocketException.cs" />
|
||||
<Compile Include="Components\Add.cs" />
|
||||
@@ -81,6 +84,10 @@
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.5.0.8\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PropertyChanged">
|
||||
<HintPath>..\packages\PropertyChanged.Fody.1.41.0.0\Lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\PropertyChanged.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.IO">
|
||||
<HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl4+win8+wp71\System.IO.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -106,6 +113,9 @@
|
||||
<Name>NReadability</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="FodyWeavers.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
@@ -119,6 +129,7 @@
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
||||
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||
</Target>
|
||||
<Import Project="Fody.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -7,11 +7,11 @@ using System.Runtime.InteropServices;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("PocketSharp")]
|
||||
[assembly: AssemblyDescription("PocketSharp is a .NET class library that integrates the Pocket API v3")]
|
||||
[assembly: AssemblyDescription("PocketSharp is a .NET class library that integrates the Pocket API v3 (support a custom Article View API)")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("cee")]
|
||||
[assembly: AssemblyProduct("PocketSharp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyCopyright("Copyright © cee 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -25,5 +25,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.0.0")]
|
||||
[assembly: AssemblyVersion("2.1.0")]
|
||||
[assembly: AssemblyFileVersion("2.1.0")]
|
||||
@@ -1,9 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using PocketSharp.Models;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Fody" version="1.17.4.0" targetFramework="portable-net403+sl40+wp71+win" />
|
||||
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="portable-net45+sl40+wp71+win" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="portable-net45+sl40+wp71+win" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="portable-net45+sl40+wp71+win" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.15" targetFramework="portable-net403+sl40+wp71+win" />
|
||||
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="portable-net45+sl40+wp71+win" />
|
||||
<package id="PropertyChanged.Fody" version="1.41.0.0" targetFramework="portable-net403+sl40+wp71+win" />
|
||||
</packages>
|
||||
@@ -11,7 +11,7 @@
|
||||
<RootNamespace>PocketSharp.Ports.NReadability</RootNamespace>
|
||||
<AssemblyName>PocketSharp.Ports.NReadability</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile104</TargetFrameworkProfile>
|
||||
<TargetFrameworkProfile>Profile96</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -397,7 +397,6 @@ namespace PocketSharp.Ports.Sgml
|
||||
private string m_rootElementName;
|
||||
|
||||
private string m_href;
|
||||
private string m_errorLogFile;
|
||||
private Entity m_lastError;
|
||||
private string m_proxy;
|
||||
private TextReader m_inputStream;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<RootNamespace>PocketSharp.Ports.SgmlReader</RootNamespace>
|
||||
<AssemblyName>PocketSharp.Ports.SgmlReader</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile104</TargetFrameworkProfile>
|
||||
<TargetFrameworkProfile>Profile96</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
@@ -20,7 +20,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||

|
||||
|
||||
**PocketSharp** is a C#.NET class library, that integrates the [Pocket API v3](http://getpocket.com/developer).
|
||||
**PocketSharp** is a C#.NET portable class library that integrates the [Pocket API v3](http://getpocket.com/developer).
|
||||
|
||||
**Website:** [pocketsharp.frontendplay.com](http://pocketsharp.frontendplay.com/)
|
||||
<br>
|
||||
**NuGet:** [nuget.org/packages/PocketSharp](https://www.nuget.org/packages/PocketSharp/)
|
||||
|
||||
|
||||
## Install using NuGet
|
||||
## Install using [NuGet](https://www.nuget.org/packages/PocketSharp/)
|
||||
|
||||
```
|
||||
Install-Package PocketSharp
|
||||
@@ -15,32 +10,71 @@ Install-Package PocketSharp
|
||||
|
||||
## Documentation
|
||||
|
||||
See [wiki](https://github.com/ceee/PocketSharp/wiki) or [website](http://pocketsharp.frontendplay.com/).
|
||||
See [wiki](https://github.com/ceee/PocketSharp/wiki)
|
||||
|
||||
---
|
||||
|
||||
## Usage Example:
|
||||
|
||||
A search for items containing `CSS`:
|
||||
|
||||
```csharp
|
||||
PocketClient client = new PocketClient("[YOUR_CONSUMER_KEY]", "[YOUR_ACCESS_CODE]");
|
||||
|
||||
List<PocketItem> items = await client.Search("css");
|
||||
|
||||
items.ForEach(
|
||||
item => Debug.WriteLine(item.ID + " | " + item.Title)
|
||||
);
|
||||
```
|
||||
|
||||
Which will output:
|
||||
|
||||
330361896 | CSS Front-end Frameworks with comparison : By usabli.ca
|
||||
345541438 | Editr - HTML, CSS, JavaScript playground
|
||||
251743431 | CSS Architecture
|
||||
343693149 | CSS3 Transitions - Thank God We Have A Specification!
|
||||
...
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Supported platforms
|
||||
|
||||
PocketSharp is a **Portable Class Library** (since 1.0.0), therefore it's compatible with multiple platforms:
|
||||
|
||||
- **.NET** >= 4.0.3 (including WPF)
|
||||
- **.NET** >= 4.5 (including WPF)
|
||||
- **Silverlight** >= 4
|
||||
- **Windows Phone** >= 7.5
|
||||
- **Windows Store**
|
||||
|
||||
You can find examples for Silverlight 5, WP8 and WPF in the `PocketSharp.Examples` ([@github](https://github.com/ceee/PocketSharp/tree/master/PocketSharp.Examples)) folder.
|
||||
|
||||
---
|
||||
## What's next?
|
||||
|
||||
- `cancellationToken` support for all methods
|
||||
|
||||
## Dependencies
|
||||
|
||||
- [Microsoft.Bcl.Async](https://www.nuget.org/packages/Microsoft.Bcl.Async/)
|
||||
- [Microsoft.Net.Http](https://www.nuget.org/packages/Microsoft.Net.Http/)
|
||||
- [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/)
|
||||
- [PropertyChanged.Fody](https://github.com/Fody/PropertyChanged)
|
||||
|
||||
## Forked Dependencies
|
||||
|
||||
- [NReadability](https://github.com/marek-stoj/NReadability) - converted to a PCL with minor adaptations
|
||||
- [SgmlReader](https://github.com/MindTouch/SGMLReader) - converted to a PCL
|
||||
|
||||
## Contributors
|
||||
| [](http://twitter.com/artistandsocial "Follow @artistandsocial on Twitter") |
|
||||
| [](https://github.com/ceee "Tobias Klika") |
|
||||
|---|
|
||||
| [Tobias Klika @ceee](https://github.com/ceee) |
|
||||
|
||||
| [](https://github.com/ScottIsAFool "Scott Lovegrove") |
|
||||
|---|
|
||||
| [Scott Lovegrove @ScottIsAFool](https://github.com/ScottIsAFool) |
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](https://github.com/ceee/PocketSharp/blob/master/LICENSE-MIT)
|
||||
|
||||
Reference in New Issue
Block a user