Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b19739fc9 | |||
| ff8bbf17d3 | |||
| da892067ad | |||
| 3992a988fc | |||
| 2a98cfb0e4 | |||
| 3057612872 | |||
| 56180b5829 |
+7
-2
@@ -1,8 +1,13 @@
|
||||
### 2.2.0 (2013-10-26)
|
||||
|
||||
- Made `GetAccessCode` obsolete
|
||||
- Return username after authentication with `GetUser` (thanks to [ScottIsAFool](https://github.com/ScottIsAFool))
|
||||
|
||||
### 2.1.0 (2013-10-25)
|
||||
|
||||
- Rename `Statistics()` to `GetUserStatistics()`
|
||||
- Made `CallbackUri` public (thanks to @ScottIsAFool)
|
||||
- Added Fody/PropertyChanged (thanks to @ScottIsAFool)
|
||||
- Made `CallbackUri` public (thanks to [ScottIsAFool](https://github.com/ScottIsAFool))
|
||||
- Added Fody/PropertyChanged (thanks to [ScottIsAFool](https://github.com/ScottIsAFool))
|
||||
- Method `GetUsageLimits()` to retrieve API usage limits
|
||||
- Add PORTABLE constant to SgmlReader
|
||||
|
||||
|
||||
@@ -74,11 +74,17 @@
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Runtime">
|
||||
<HintPath>..\..\packages\Microsoft.Bcl.1.0.19\lib\sl5\System.Runtime.dll</HintPath>
|
||||
<Reference Include="System.IO, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Microsoft.Bcl.1.1.3\lib\sl5\System.IO.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks">
|
||||
<HintPath>..\..\packages\Microsoft.Bcl.1.0.19\lib\sl5\System.Threading.Tasks.dll</HintPath>
|
||||
<Reference Include="System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Microsoft.Bcl.1.1.3\lib\sl5\System.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Microsoft.Bcl.1.1.3\lib\sl5\System.Threading.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="system" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl" version="1.0.19" targetFramework="sl50" />
|
||||
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="sl50" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="sl50" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="sl50" />
|
||||
</packages>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
@@ -49,12 +49,13 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.Extensions">
|
||||
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.13\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.13.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.13\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Xml" />
|
||||
@@ -140,4 +141,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.13.0" newVersion="4.2.13.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.15.0" newVersion="4.2.15.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.13" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.15" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -46,11 +46,13 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.Extensions">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="xunit">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
using PocketSharp.Models;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace PocketSharp.Tests
|
||||
{
|
||||
@@ -42,5 +42,18 @@ namespace PocketSharp.Tests
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task IsBodyOnlyProperlyResolved()
|
||||
{
|
||||
PocketArticle result = await reader.Read(new PocketItem()
|
||||
{
|
||||
ID = 99,
|
||||
Uri = new Uri("http://calebjacob.com/tooltipster/")
|
||||
});
|
||||
|
||||
Assert.True(result.Content.Substring(0, 4) == "<div");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.13.0" newVersion="4.2.13.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.15.0" newVersion="4.2.15.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.13" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.15" targetFramework="net45" />
|
||||
<package id="xunit" version="1.9.2" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -65,36 +65,51 @@ namespace PocketSharp
|
||||
|
||||
/// <summary>
|
||||
/// Requests the access code after authentication
|
||||
/// The access code has to permanently be stored within the users session, and should be added as a parameter for all future PocketClient initializations.
|
||||
/// The access code has to permanently be stored within the users session, and should be passed in the constructor for all future PocketClient initializations.
|
||||
/// </summary>
|
||||
/// <param name="requestCode">The requestCode. If no requestCode is supplied, the property from the PocketClient intialization is used.</param>
|
||||
/// <returns>The permanent access code, which is used to authenticate the user with the application</returns>
|
||||
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
|
||||
/// <exception cref="PocketException"></exception>
|
||||
[Obsolete("Please use GetUser instead")]
|
||||
public async Task<string> GetAccessCode(string requestCode = null)
|
||||
{
|
||||
await GetUser(requestCode);
|
||||
return AccessCode;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Requests the access code and username after authentication
|
||||
/// The access code has to permanently be stored within the users session, and should be passed in the constructor for all future PocketClient initializations.
|
||||
/// </summary>
|
||||
/// <param name="requestCode">The request code.</param>
|
||||
/// <returns>The authenticated user</returns>
|
||||
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
|
||||
public async Task<PocketUser> GetUser(string requestCode = null)
|
||||
{
|
||||
// check if request code is available
|
||||
if(RequestCode == null && requestCode == null)
|
||||
if (RequestCode == null && requestCode == null)
|
||||
{
|
||||
throw new NullReferenceException("Call GetRequestCode() first to receive a request_code");
|
||||
}
|
||||
|
||||
// override property with given param if available
|
||||
if(requestCode != null)
|
||||
if (requestCode != null)
|
||||
{
|
||||
RequestCode = requestCode;
|
||||
}
|
||||
|
||||
// do request
|
||||
AccessCode response = await Request<AccessCode>("oauth/authorize", new Dictionary<string, string>()
|
||||
{
|
||||
{ "code", RequestCode }
|
||||
PocketUser response = await Request<PocketUser>("oauth/authorize", new Dictionary<string, string>()
|
||||
{
|
||||
{"code", RequestCode}
|
||||
}, false);
|
||||
|
||||
// save code to client
|
||||
AccessCode = response.Code;
|
||||
|
||||
return AccessCode;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace PocketSharp
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="PocketException"></exception>
|
||||
[Obsolete("Please use GetUserStatistics")]
|
||||
[Obsolete("Please use GetUserStatistics instead")]
|
||||
public async Task<PocketStatistics> Statistics()
|
||||
{
|
||||
return await GetUserStatistics();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
@@ -6,7 +7,8 @@ namespace PocketSharp.Models
|
||||
/// Access Code
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
internal class AccessCode
|
||||
[ImplementPropertyChanged]
|
||||
public class PocketUser
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the code.
|
||||
@@ -23,7 +25,7 @@ namespace PocketSharp.Models
|
||||
/// <value>
|
||||
/// The username.
|
||||
/// </value>
|
||||
[JsonProperty]
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace PocketSharp
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Encoding", "gzip,deflate");
|
||||
|
||||
// add user agent (default for Opera with PocketSharp identifier appended)
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.4 Safari/537.36 OPR/18.0.1284.2 PocketSharp/2.0");
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.4 Safari/537.36 OPR/18.0.1284.2 PocketSharp/2.2");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<Compile Include="Models\PocketItem.cs" />
|
||||
<Compile Include="Models\PocketTag.cs" />
|
||||
<Compile Include="Models\PocketVideo.cs" />
|
||||
<Compile Include="Models\Response\AccessCode.cs" />
|
||||
<Compile Include="Models\PocketUser.cs" />
|
||||
<Compile Include="Models\Response\Add.cs" />
|
||||
<Compile Include="Models\Response\Modify.cs" />
|
||||
<Compile Include="Models\Response\RequestCode.cs" />
|
||||
@@ -107,15 +107,15 @@
|
||||
<HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl4+win8+wp71\System.Threading.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="FodyWeavers.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PortablePorts\NReadability\NReadability.csproj">
|
||||
<Project>{14c3ee6a-54a4-4a37-8b56-d52a3802f1c2}</Project>
|
||||
<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">
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
<owners>$author$</owners>
|
||||
<licenseUrl>https://raw.github.com/ceee/PocketSharp/master/LICENSE-MIT</licenseUrl>
|
||||
<projectUrl>http://pocketsharp.frontendplay.com</projectUrl>
|
||||
<iconUrl>http://pocketsharp.frontendplay.com/Assets/Images/pocketsharp.png</iconUrl>
|
||||
<iconUrl>https://raw.github.com/ceee/PocketSharp/master/pocketsharp.png</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>PocketSharp is a .NET class library, that integrates the Pocket API v3</description>
|
||||
<description>PocketSharp is a C#.NET portable class library that integrates the Pocket API v3.</description>
|
||||
<language>en-US</language>
|
||||
<releaseNotes>
|
||||
<![CDATA[
|
||||
For full release notes see https://github.com/ceee/PocketSharp/blob/master/CHANGELOG.md
|
||||
]]>
|
||||
For full release notes see https://github.com/ceee/PocketSharp/blob/master/CHANGELOG.md
|
||||
]]>
|
||||
</releaseNotes>
|
||||
<copyright>Copyright by cee, 2013</copyright>
|
||||
<tags>PocketAPI Pocket API PocketSharp Tobias Klika cee NReadability Reader Article SDK Pockem</tags>
|
||||
|
||||
@@ -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.1.0")]
|
||||
[assembly: AssemblyFileVersion("2.1.0")]
|
||||
[assembly: AssemblyVersion("2.2.1")]
|
||||
[assembly: AssemblyFileVersion("2.2.1")]
|
||||
@@ -84,7 +84,7 @@ namespace PocketSharp.Ports.NReadability
|
||||
|
||||
if (domSerializationParams.BodyOnly && document.Root != null)
|
||||
{
|
||||
var body = document.Root.GetChildrenByTagName("body").FirstOrDefault();
|
||||
var body = document.Root.GetElementsByTagName("body").FirstOrDefault();
|
||||
|
||||
if (body != null)
|
||||
{
|
||||
|
||||
@@ -67,13 +67,9 @@ You can find examples for Silverlight 5, WP8 and WPF in the `PocketSharp.Example
|
||||
- [SgmlReader](https://github.com/MindTouch/SGMLReader) - converted to a PCL
|
||||
|
||||
## Contributors
|
||||
| [](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) |
|
||||
| [](https://github.com/ceee "Tobias Klika") | [](https://github.com/ScottIsAFool "Scott Lovegrove") |
|
||||
|---|---|
|
||||
| [ceee](https://github.com/ceee) | [ScottIsAFool](https://github.com/ScottIsAFool) |
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
Reference in New Issue
Block a user