fix Action parameter "url", so batch adding is working now
This commit is contained in:
@@ -70,25 +70,56 @@ namespace PocketSharp.Tests
|
||||
[Fact]
|
||||
public async Task ItemViaActionsIsAdded()
|
||||
{
|
||||
var uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy");
|
||||
List<PocketAction> actions = new List<PocketAction>();
|
||||
|
||||
PocketAction action = new PocketAction()
|
||||
actions.Add(new PocketAction()
|
||||
{
|
||||
Uri = uri,
|
||||
Uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy"),
|
||||
Action = "add",
|
||||
Time = DateTime.Now
|
||||
};
|
||||
});
|
||||
|
||||
bool success = await client.SendAction(action);
|
||||
bool success = await client.SendActions(actions);
|
||||
|
||||
Assert.True(success);
|
||||
|
||||
IEnumerable<PocketItem> items = await client.Search("String Indexer");
|
||||
IEnumerable<PocketItem> items = await client.Search("in nancy");
|
||||
|
||||
Assert.NotNull(items);
|
||||
Assert.True(items.Count() > 0);
|
||||
|
||||
itemsToDelete.Add(items.First().ID);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task ItemsViaActionsIsAdded()
|
||||
{
|
||||
List<PocketAction> actions = new List<PocketAction>();
|
||||
|
||||
actions.Add(new PocketAction()
|
||||
{
|
||||
Uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy"),
|
||||
Action = "add",
|
||||
Time = DateTime.Now
|
||||
});
|
||||
actions.Add(new PocketAction()
|
||||
{
|
||||
Uri = new Uri("http://frontendplay.com/story/4013/build-a-custom-razor-viewbase-in-nancy"),
|
||||
Action = "add",
|
||||
Time = DateTime.Now
|
||||
});
|
||||
|
||||
bool success = await client.SendActions(actions);
|
||||
|
||||
Assert.True(success);
|
||||
|
||||
IEnumerable<PocketItem> items = await client.Search("in nancy");
|
||||
|
||||
Assert.NotNull(items);
|
||||
Assert.True(items.Count() == 2);
|
||||
|
||||
itemsToDelete.AddRange(items.Select(item => item.ID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
@@ -120,7 +121,7 @@ namespace PocketSharp.Models
|
||||
if (!String.IsNullOrEmpty(TweetID))
|
||||
parameters.Add("ref_id", TweetID);
|
||||
if (Uri != null)
|
||||
parameters.Add("uri", Uri.ToString());
|
||||
parameters.Add("url", Uri.OriginalString);
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace PocketSharp.Models
|
||||
/// <value>
|
||||
/// The action results.
|
||||
/// </value>
|
||||
[JsonProperty("action_results")]
|
||||
public bool[] ActionResults { get; set; }
|
||||
//[JsonProperty("action_results")]
|
||||
//public bool[] ActionResults { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,9 +316,7 @@ namespace PocketSharp
|
||||
"actions", JsonConvert.SerializeObject(actionParameters.Select(action => action.Convert()))
|
||||
}};
|
||||
|
||||
Modify result = (await Request<Modify>("send", cancellationToken, parameters));
|
||||
|
||||
return result.ActionResults != null ? !result.ActionResults.Contains(false) : result.Status;
|
||||
return (await Request<Modify>("send", cancellationToken, parameters)).Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user