Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
fix json converter bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ceee committed Jul 12, 2018
1 parent 281034a commit 000c821
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion PocketSharp/Components/Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public async Task<IEnumerable<PocketItem>> Get(
Domain = domain,
Since = since.HasValue ? ((DateTime)since).ToUniversalTime() : since,
Count = count,
Offset = offset
Offset = offset,
Version = 2
};

return (await Request<Retrieve>("get", cancellationToken, parameters.Convert())).Items ?? new List<PocketItem>();
Expand Down
2 changes: 0 additions & 2 deletions PocketSharp/Models/Parameters/Parameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public Dictionary<string, string> Convert()
parameterDict.Add(name, value.ToString());
}

parameterDict.Add("version", "2");

return parameterDict;
}
}
Expand Down
11 changes: 10 additions & 1 deletion PocketSharp/Models/Parameters/RetrieveParameters.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.Serialization;

namespace PocketSharp.Models
Expand Down Expand Up @@ -107,6 +107,15 @@ internal class RetrieveParameters : Parameters
/// </value>
[DataMember(Name = "offset")]
public int? Offset { get; set; }

/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>
/// The version.
/// </value>
[DataMember(Name = "version")]
public int? Version { get; set; }
}


Expand Down
4 changes: 2 additions & 2 deletions PocketSharp/Utilities/JsonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
}

double value;
if (!Double.TryParse((string)reader.Value, out value))
if (!Double.TryParse(reader.Value.ToString(), out value))
{
DateTime date;
if (DateTime.TryParse((string)reader.Value, out date))
if (DateTime.TryParse(reader.Value.ToString(), out date))
{
return date;
}
Expand Down

0 comments on commit 000c821

Please sign in to comment.