Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b8d211e151 | |||
| c31b771cdb | |||
| e0f96a092c | |||
| 0301bbaf10 | |||
| 5266f220e9 | |||
| c83971b4cc | |||
| 1567709ace | |||
| 342f16fb8e | |||
| 423be2df5f | |||
| 1605740107 | |||
| b7b92d87ed | |||
| 01c36a047a | |||
| 140e645e86 | |||
| 97919cdd18 | |||
| 761d670c65 |
@@ -1,3 +1,32 @@
|
||||
### 4.1.6 (2014-08-28)
|
||||
|
||||
- Fix DateTime conversion issue (from local to UTC)
|
||||
|
||||
### 4.1.5 (2014-07-27)
|
||||
|
||||
- Fix StackOverflow bug in PocketItem equality overload (fixes #28)
|
||||
|
||||
### 4.1.4 (2014-07-18)
|
||||
|
||||
- Implement WebAuthenticationBroker-view toggle
|
||||
|
||||
### 4.1.3 (2014-06-25)
|
||||
|
||||
- Only dispose response if available
|
||||
|
||||
### 4.1.2 (2014-06-18)
|
||||
|
||||
- Add force param to login+registration
|
||||
|
||||
### 4.1.1 (2014-06-17)
|
||||
|
||||
- Fix batch adding bug
|
||||
|
||||
|
||||
### 4.1.0 (2014-06-16)
|
||||
|
||||
- Include access to the Article View API
|
||||
|
||||
### 4.0.0 (2014-04-03)
|
||||
|
||||
- Support for Universal apps (dropped SL and WP7 support)
|
||||
|
||||
@@ -33,23 +33,23 @@ namespace PocketSharp.Tests
|
||||
Assert.True(item.Uri == itemDuplicate.Uri);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IsItemJsonPopulated()
|
||||
{
|
||||
List<PocketItem> items = (await client.Get()).ToList();
|
||||
string schemaJson = @"{
|
||||
'description': 'PocketItem',
|
||||
'type': 'object'
|
||||
}";
|
||||
// [Fact]
|
||||
// public async Task IsItemJsonPopulated()
|
||||
// {
|
||||
// List<PocketItem> items = (await client.Get()).ToList();
|
||||
// string schemaJson = @"{
|
||||
// 'description': 'PocketItem',
|
||||
// 'type': 'object'
|
||||
// }";
|
||||
|
||||
JsonSchema schema = JsonSchema.Parse(schemaJson);
|
||||
foreach (var pocketItem in items)
|
||||
{
|
||||
Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json));
|
||||
var jObject = JObject.Parse(pocketItem.Json);
|
||||
Assert.True(jObject.IsValid(schema));
|
||||
}
|
||||
}
|
||||
// JsonSchema schema = JsonSchema.Parse(schemaJson);
|
||||
// foreach (var pocketItem in items)
|
||||
// {
|
||||
// Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json));
|
||||
// var jObject = JObject.Parse(pocketItem.Json);
|
||||
// Assert.True(jObject.IsValid(schema));
|
||||
// }
|
||||
// }
|
||||
|
||||
[Fact]
|
||||
public async Task AreFilteredItemsRetrieved()
|
||||
@@ -194,7 +194,7 @@ namespace PocketSharp.Tests
|
||||
[Fact]
|
||||
public async Task IsSinceParameterWorkingOnAddTags()
|
||||
{
|
||||
DateTime since = DateTime.UtcNow;
|
||||
DateTime since = DateTime.Now;
|
||||
|
||||
IEnumerable<PocketItem> items = await client.Get(state: State.all);
|
||||
PocketItem itemToModify = items.First();
|
||||
@@ -218,7 +218,7 @@ namespace PocketSharp.Tests
|
||||
[Fact]
|
||||
public async Task IsSinceParameterWorkingOnFavoriteAndArchiveModification()
|
||||
{
|
||||
DateTime since = DateTime.UtcNow;
|
||||
DateTime since = DateTime.Now;//1409221736
|
||||
|
||||
IEnumerable<PocketItem> items = await client.Get(state: State.all);
|
||||
PocketItem itemToModify = items.First();
|
||||
@@ -237,7 +237,7 @@ namespace PocketSharp.Tests
|
||||
|
||||
await client.Unfavorite(itemToModify);
|
||||
|
||||
since = DateTime.UtcNow.AddMinutes(-1);
|
||||
since = DateTime.Now;
|
||||
|
||||
await client.Archive(itemToModify);
|
||||
|
||||
@@ -249,6 +249,28 @@ namespace PocketSharp.Tests
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task IsUTCSinceParameterWorking()
|
||||
{
|
||||
DateTime since = DateTime.UtcNow;
|
||||
|
||||
IEnumerable<PocketItem> items = await client.Get(state: State.all);
|
||||
PocketItem itemToModify = items.First();
|
||||
|
||||
items = await client.Get(state: State.all, since: since);
|
||||
|
||||
Assert.True(items == null || items.Count() == 0);
|
||||
|
||||
await client.Favorite(itemToModify);
|
||||
|
||||
items = await client.Get(state: State.all, since: since);
|
||||
|
||||
Assert.True(items.Count() > 0);
|
||||
|
||||
await client.Unfavorite(itemToModify);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task IsSinceParameterWorkingOnAddAndDelete()
|
||||
{
|
||||
|
||||
@@ -105,13 +105,27 @@ namespace PocketSharp.Tests
|
||||
string[] tag;
|
||||
Random rnd = new Random();
|
||||
|
||||
foreach (string url in urls.Skip(offset).Take(count))
|
||||
var items = urls.Skip(offset).Take(count)
|
||||
.Select((value, idx) => new { Value = value, Index = idx })
|
||||
.GroupBy(item => item.Index / 100, item => item.Value)
|
||||
.Cast<IEnumerable<string>>();
|
||||
|
||||
foreach (IEnumerable<string> urlGroup in items)
|
||||
{
|
||||
r = rnd.Next(tags.Length);
|
||||
r2 = rnd.Next(tags.Length);
|
||||
tag = new string[] { tags[r], tags[r2] };
|
||||
await client.Add(new Uri("http://" + url), tag);
|
||||
await Task.WhenAll(urlGroup.Select(url =>
|
||||
{
|
||||
r = rnd.Next(tags.Length);
|
||||
r2 = rnd.Next(tags.Length);
|
||||
tag = new string[] { tags[r], tags[r2] };
|
||||
return client.Add(new Uri("http://" + url), tag);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
//public async Task Fillll()
|
||||
//{
|
||||
// await FillAccount(11000, 89999);
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,32 @@ namespace PocketSharp
|
||||
RequestCode = requestCode;
|
||||
}
|
||||
|
||||
return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0"));
|
||||
return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0", "login", useInsideWebAuthenticationBroker ? "1" : "0"));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generate registration URI from requestCode
|
||||
/// Follow the steps as with GenerateAuthenticationUri, but for unregistered users
|
||||
/// </summary>
|
||||
/// <param name="requestCode">The requestCode. If no requestCode is supplied, the property from the PocketClient intialization is used.</param>
|
||||
/// <returns>A valid URI to redirect the user to.</returns>
|
||||
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
|
||||
public Uri GenerateRegistrationUri(string requestCode = null)
|
||||
{
|
||||
// check if request code is available
|
||||
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)
|
||||
{
|
||||
RequestCode = requestCode;
|
||||
}
|
||||
|
||||
return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0", "signup", useInsideWebAuthenticationBroker ? "1" : "0"));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,30 +124,5 @@ namespace PocketSharp
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generate registration URI from requestCode
|
||||
/// Follow the steps as with GenerateAuthenticationUri, but for unregistered users
|
||||
/// </summary>
|
||||
/// <param name="requestCode">The requestCode. If no requestCode is supplied, the property from the PocketClient intialization is used.</param>
|
||||
/// <returns>A valid URI to redirect the user to.</returns>
|
||||
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
|
||||
public Uri GenerateRegistrationUri(string requestCode = null)
|
||||
{
|
||||
// check if request code is available
|
||||
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)
|
||||
{
|
||||
RequestCode = requestCode;
|
||||
}
|
||||
|
||||
return new Uri(String.Format("{0}&force=signup", String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,12 +53,12 @@ namespace PocketSharp
|
||||
DetailType = DetailType.complete,
|
||||
Search = search,
|
||||
Domain = domain,
|
||||
Since = since,
|
||||
Since = since.HasValue ? ((DateTime)since).ToUniversalTime() : since,
|
||||
Count = count,
|
||||
Offset = offset
|
||||
};
|
||||
|
||||
return (await Request<Retrieve>("get", cancellationToken, parameters.Convert())).Items;
|
||||
return (await Request<Retrieve>("get", cancellationToken, parameters.Convert())).Items ?? new List<PocketItem>();
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace PocketSharp
|
||||
/// You have to pass the parseUri in the PocketClient ctor for this method to work.
|
||||
/// This is a private API and can only be used by authenticated users.
|
||||
/// </summary>
|
||||
/// <param name="tag">The article URI.</param>
|
||||
/// <param name="uri">The article URI.</param>
|
||||
/// <param name="includeImages">Include images into content or use placeholder.</param>
|
||||
/// <param name="includeVideos">Include videos into content or use placeholder.</param>
|
||||
/// <param name="forceRefresh">Force refresh of the content (don't use cache).</param>
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace PocketSharp
|
||||
/// <exception cref="PocketException"></exception>
|
||||
Task<bool> RenameTag(PocketItem item, string oldTag, string newTag, CancellationToken cancellationToken = default(CancellationToken));
|
||||
#endregion
|
||||
|
||||
|
||||
#region statistics methods
|
||||
/// <summary>
|
||||
/// Statistics from the user account.
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace PocketSharp.Models
|
||||
// convert DateTime to UNIX timestamp
|
||||
if (value is DateTime)
|
||||
{
|
||||
value = (int)((DateTime)value - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
value = (int)((DateTime)value - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
|
||||
}
|
||||
|
||||
parameterDict.Add(name, value.ToString());
|
||||
|
||||
@@ -168,15 +168,6 @@ namespace PocketSharp.Models
|
||||
[JsonProperty("is_article")]
|
||||
public bool IsArticle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance has image.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance has image; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
[JsonProperty("has_image")]
|
||||
private PocketBoolean? _HasImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance has video.
|
||||
/// </summary>
|
||||
@@ -186,21 +177,6 @@ namespace PocketSharp.Models
|
||||
[JsonProperty("has_video")]
|
||||
private PocketBoolean? _HasVideo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether [has image].
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if [has image]; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
[JsonIgnore]
|
||||
public bool HasImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _HasImage == PocketBoolean.Yes || _HasImage == PocketBoolean.IsType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether [has video].
|
||||
/// </summary>
|
||||
@@ -231,21 +207,6 @@ namespace PocketSharp.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether [is image].
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if [is image]; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
[JsonIgnore]
|
||||
public bool IsImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _HasImage == PocketBoolean.IsType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the word count.
|
||||
/// </summary>
|
||||
@@ -283,24 +244,6 @@ namespace PocketSharp.Models
|
||||
[JsonProperty("time_updated")]
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the read time.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The read time.
|
||||
/// </value>
|
||||
[JsonProperty("time_read")]
|
||||
public DateTime? ReadTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the favorite time.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The favorite time.
|
||||
/// </value>
|
||||
[JsonProperty("time_favorited")]
|
||||
public DateTime? FavoriteTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tags as comma-separated strings.
|
||||
/// </summary>
|
||||
@@ -365,15 +308,6 @@ namespace PocketSharp.Models
|
||||
get { return Images != null && Images.Count() > 0 ? Images.First() : null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets and sets the JSON the model was deserialized from
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Model's original JSON representation
|
||||
/// </value>
|
||||
[JsonIgnore]
|
||||
public string Json { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
|
||||
/// </summary>
|
||||
@@ -432,9 +366,9 @@ namespace PocketSharp.Models
|
||||
/// </returns>
|
||||
public static bool operator ==(PocketItem a, PocketItem b)
|
||||
{
|
||||
if (a == null || b == null)
|
||||
if (Object.ReferenceEquals(a, b))
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
PocketItem itemA = (PocketItem)a;
|
||||
|
||||
@@ -45,13 +45,23 @@ namespace PocketSharp
|
||||
/// <summary>
|
||||
/// The authentification URL
|
||||
/// </summary>
|
||||
protected string authentificationUri = "https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}&mobile={2}";
|
||||
protected string authentificationUri = "https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}&mobile={2}&force={3}&webauthenticationbroker={4}";
|
||||
|
||||
/// <summary>
|
||||
/// Indicates, whether this client is used for mobile or desktop
|
||||
/// </summary>
|
||||
protected bool isMobileClient = true;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates, whether this client is used inside a broker (on Windows 8)
|
||||
/// </summary>
|
||||
protected bool useInsideWebAuthenticationBroker = true;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates, whether the last HTTP response is cached
|
||||
/// </summary>
|
||||
protected bool cacheHTTPResponseData;
|
||||
|
||||
/// <summary>
|
||||
/// callback URLi for API calls
|
||||
/// </summary>
|
||||
@@ -103,7 +113,9 @@ namespace PocketSharp
|
||||
/// <param name="handler">The HttpMessage handler.</param>
|
||||
/// <param name="timeout">Request timeout (in seconds).</param>
|
||||
/// <param name="isMobileClient">Indicates, whether this client is used for mobile or desktop</param>
|
||||
/// <param name="useInsideWebAuthenticationBroker">Indicates, whether this client is used inside a broker (on Windows 8), see: http://getpocket.com/developer/docs/getstarted/windows8 </param>
|
||||
/// <param name="parserUri">Enables the wrapper for the private Text Parser API</param>
|
||||
/// <param name="cacheHTTPResponseData">Caches the last HTTP response in public properties</param>
|
||||
public PocketClient(
|
||||
string consumerKey,
|
||||
string accessCode = null,
|
||||
@@ -111,12 +123,16 @@ namespace PocketSharp
|
||||
HttpMessageHandler handler = null,
|
||||
int? timeout = null,
|
||||
bool isMobileClient = true,
|
||||
Uri parserUri = null)
|
||||
bool useInsideWebAuthenticationBroker = false,
|
||||
Uri parserUri = null,
|
||||
bool cacheHTTPResponseData = true)
|
||||
{
|
||||
// assign public properties
|
||||
ConsumerKey = consumerKey;
|
||||
|
||||
this.isMobileClient = isMobileClient;
|
||||
this.useInsideWebAuthenticationBroker = useInsideWebAuthenticationBroker;
|
||||
this.cacheHTTPResponseData = cacheHTTPResponseData;
|
||||
|
||||
// assign access code if submitted
|
||||
if (accessCode != null)
|
||||
@@ -244,7 +260,10 @@ namespace PocketSharp
|
||||
ValidateResponse(response);
|
||||
|
||||
// cache headers
|
||||
lastHeaders = response.Headers;
|
||||
if (cacheHTTPResponseData)
|
||||
{
|
||||
lastHeaders = response.Headers;
|
||||
}
|
||||
|
||||
// read response
|
||||
responseString = await response.Content.ReadAsStringAsync();
|
||||
@@ -260,11 +279,18 @@ namespace PocketSharp
|
||||
finally
|
||||
{
|
||||
request.Dispose();
|
||||
response.Dispose();
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
response.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// cache response
|
||||
lastResponseData = responseString;
|
||||
if (cacheHTTPResponseData)
|
||||
{
|
||||
lastResponseData = responseString;
|
||||
}
|
||||
|
||||
return DeserializeJson<T>(responseString);
|
||||
}
|
||||
@@ -312,6 +338,11 @@ namespace PocketSharp
|
||||
/// <returns></returns>
|
||||
internal async Task<bool> Send(IEnumerable<PocketAction> actionParameters, CancellationToken cancellationToken)
|
||||
{
|
||||
foreach (PocketAction action in actionParameters)
|
||||
{
|
||||
action.Time = action.Time.HasValue ? ((DateTime)action.Time).ToUniversalTime() : action.Time;
|
||||
}
|
||||
|
||||
Dictionary<string, string> parameters = new Dictionary<string, string>() {{
|
||||
"actions", JsonConvert.SerializeObject(actionParameters.Select(action => action.Convert()))
|
||||
}};
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>10f8a946</NuGetPackageImportStamp>
|
||||
<NuGetPackageImportStamp>06ad0893</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -57,7 +57,6 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -99,20 +98,20 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.2\lib\portable-net40+sl5+wp80+win8+monotouch+monoandroid\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PropertyChanged">
|
||||
<HintPath>..\packages\PropertyChanged.Fody.1.48.0.0\Lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\PropertyChanged.dll</HintPath>
|
||||
<HintPath>..\packages\PropertyChanged.Fody.1.48.3\Lib\portable-net4+sl4+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\PropertyChanged.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Extensions">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.19\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.22\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -137,14 +136,14 @@
|
||||
<ErrorText>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=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.1.22.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.22.1\build\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.1.24.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.24.0\build\Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Fody.1.22.1\build\Fody.targets" Condition="Exists('..\packages\Fody.1.22.1\build\Fody.targets')" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\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.14\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="..\packages\Fody.1.24.0\build\Fody.targets" Condition="Exists('..\packages\Fody.1.24.0\build\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">
|
||||
|
||||
@@ -22,5 +22,5 @@
|
||||
// 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("4.1.1")]
|
||||
[assembly: AssemblyFileVersion("4.1.1")]
|
||||
[assembly: AssemblyVersion("4.1.6.0")]
|
||||
[assembly: AssemblyFileVersion("4.1.6.0")]
|
||||
@@ -32,10 +32,11 @@ namespace PocketSharp
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
DateTime epoc = new DateTime(1970, 1, 1);
|
||||
var delta = (DateTime)value - epoc;
|
||||
DateTime date = ((DateTime)value).ToUniversalTime();
|
||||
DateTime epoc = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
var delta = date.Subtract(epoc);
|
||||
|
||||
writer.WriteValue((long)delta.TotalSeconds);
|
||||
writer.WriteValue((int)Math.Truncate(delta.TotalSeconds));
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
@@ -50,7 +51,7 @@ namespace PocketSharp
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Convert.ToDouble(reader.Value)).ToLocalTime();
|
||||
return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Convert.ToDouble(reader.Value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,11 +188,10 @@ namespace PocketSharp
|
||||
|
||||
public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer)
|
||||
{
|
||||
|
||||
var jObject = JObject.ReadFrom(reader);
|
||||
var pocketItem = new PocketItem();
|
||||
serializer.Populate(jObject.CreateReader(), pocketItem);
|
||||
pocketItem.Json = jObject.ToString();
|
||||
//pocketItem.Json = jObject.ToString();
|
||||
|
||||
return pocketItem;
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.7.0" newVersion="2.6.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.7.0" newVersion="2.6.7.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Fody" version="1.22.1" targetFramework="portable-net403+sl50+win+wp80" developmentDependency="true" />
|
||||
<package id="Microsoft.Bcl" version="1.1.7" targetFramework="portable-net403+sl50+win+wpa81+wp80" requireReinstallation="True" />
|
||||
<package id="Fody" version="1.24.0" targetFramework="portable-net45+win+wpa81+wp80" developmentDependency="true" />
|
||||
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="portable-net45+win+wpa81+wp80" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable-net403+sl50+win+wpa81+wp80" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.19" targetFramework="portable-net403+sl50+win+wpa81+wp80" />
|
||||
<package id="Newtonsoft.Json" version="6.0.2" targetFramework="portable-net403+sl50+win+wp80" requireReinstallation="True" />
|
||||
<package id="PropertyChanged.Fody" version="1.48.0.0" targetFramework="portable-net403+sl50+win+wp80" developmentDependency="true" requireReinstallation="True" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="portable-net45+win+wpa81+wp80" />
|
||||
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="portable-net45+win+wpa81+wp80" />
|
||||
<package id="PropertyChanged.Fody" version="1.48.3" targetFramework="portable-net45+win+wpa81+wp80" developmentDependency="true" />
|
||||
</packages>
|
||||
@@ -15,9 +15,8 @@ See [wiki](https://github.com/ceee/PocketSharp/wiki)
|
||||
|
||||
## Where's the Article View API?
|
||||
|
||||
PocketSharp doesn't include PocketSharp.Reader (an article view implementation) anymore.
|
||||
|
||||
**PocketSharp.Reader is now [ReadSharp](https://github.com/ceee/ReadSharp) and hosted without PocketSharp.**
|
||||
You can either use the open source [ReadSharp](https://github.com/ceee/ReadSharp) parser or if you want to use the official API by Pocket, you have to request access to it.<br>
|
||||
Afterwards you can use the access information to query the endpoint with PocketSharp. Instructions [here](https://github.com/ceee/PocketSharp/wiki/Article-parser).
|
||||
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user