remove JSON prop from PocketItem and introduce an AfterRequest action with the passed raw response
This commit is contained in:
@@ -372,15 +372,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>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using PocketSharp.Models;
|
||||
using System;
|
||||
@@ -103,6 +103,14 @@ namespace PocketSharp
|
||||
/// </value>
|
||||
public Action<string> PreRequest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Action which is executed after every request
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The after request callback.
|
||||
/// </value>
|
||||
public Action<string> AfterRequest { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PocketClient" /> class.
|
||||
@@ -233,10 +241,7 @@ namespace PocketSharp
|
||||
request.Content = new FormUrlEncodedContent(parameters);
|
||||
|
||||
// call pre request action
|
||||
if (PreRequest != null)
|
||||
{
|
||||
PreRequest(method);
|
||||
}
|
||||
PreRequest?.Invoke(method);
|
||||
|
||||
// make async request
|
||||
try
|
||||
@@ -280,6 +285,9 @@ namespace PocketSharp
|
||||
}
|
||||
}
|
||||
|
||||
// call after request action
|
||||
AfterRequest?.Invoke(responseString);
|
||||
|
||||
// cache response
|
||||
if (cacheHTTPResponseData)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user