diff --git a/PocketSharp/Components/Modify.cs b/PocketSharp/Components/Modify.cs index 0a697aa..c6b82a5 100644 --- a/PocketSharp/Components/Modify.cs +++ b/PocketSharp/Components/Modify.cs @@ -1,4 +1,5 @@ using PocketSharp.Models; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -9,6 +10,20 @@ namespace PocketSharp /// public partial class PocketClient { + /// + /// Sends multiple actions in one request. + /// See: http://getpocket.com/developer/docs/v3/modify + /// + /// The actions. + /// The cancellation token. + /// + /// + public async Task SendActions(List actions, CancellationToken cancellationToken = default(CancellationToken)) + { + return await Send(actions, cancellationToken); + } + + /// /// Archives the specified item. /// @@ -147,7 +162,7 @@ namespace PocketSharp /// protected async Task SendDefault(CancellationToken cancellationToken, int itemID, string action) { - return await Send(new ActionParameter() + return await Send(new PocketAction() { Action = action, ID = itemID diff --git a/PocketSharp/Components/ModifyTags.cs b/PocketSharp/Components/ModifyTags.cs index 1ed0291..2f61e04 100644 --- a/PocketSharp/Components/ModifyTags.cs +++ b/PocketSharp/Components/ModifyTags.cs @@ -193,7 +193,7 @@ namespace PocketSharp /// protected async Task SendTags(CancellationToken cancellationToken, int itemID, string action, string[] tags) { - return await Send(new ActionParameter() + return await Send(new PocketAction() { Action = action, ID = itemID, diff --git a/PocketSharp/Models/Parameters/ActionParameter.cs b/PocketSharp/Models/PocketAction.cs similarity index 72% rename from PocketSharp/Models/Parameters/ActionParameter.cs rename to PocketSharp/Models/PocketAction.cs index fff602a..3ab90f4 100644 --- a/PocketSharp/Models/Parameters/ActionParameter.cs +++ b/PocketSharp/Models/PocketAction.cs @@ -5,10 +5,10 @@ using System.Runtime.Serialization; namespace PocketSharp.Models { /// - /// All parameters which can be passed for a modify action + /// All parameters which can be passed for a send action /// [DataContract] - internal class ActionParameter + public class PocketAction { /// /// Gets or sets the action. @@ -20,7 +20,7 @@ namespace PocketSharp.Models public string Action { get; set; } /// - /// Gets or sets the ID. + /// Gets or sets the PocketItem ID. /// /// /// The ID. @@ -28,6 +28,24 @@ namespace PocketSharp.Models [DataMember(Name = "item_id")] public int ID { get; set; } + /// + /// Gets or sets the URI (for adding a new item). + /// + /// + /// The URI. + /// + [DataMember(Name = "url")] + public Uri Uri { get; set; } + + /// + /// Gets or sets the Title (for adding a new item). + /// + /// + /// The Title. + /// + [DataMember(Name = "title")] + public string Title { get; set; } + /// /// Gets or sets the time. /// @@ -71,7 +89,7 @@ namespace PocketSharp.Models /// Converts this instance to a parameter list. /// /// - public Dictionary Convert() + internal Dictionary Convert() { Dictionary parameters = new Dictionary { @@ -87,6 +105,10 @@ namespace PocketSharp.Models parameters.Add("old_tag", OldTag); if (NewTag != null) parameters.Add("new_tag", NewTag); + if (Title != null) + parameters.Add("title", Title); + if (Uri != null) + parameters.Add("uri", Uri.ToString()); return parameters; } diff --git a/PocketSharp/PocketClient.cs b/PocketSharp/PocketClient.cs index 5a60451..05a09d3 100644 --- a/PocketSharp/PocketClient.cs +++ b/PocketSharp/PocketClient.cs @@ -214,7 +214,7 @@ namespace PocketSharp /// /// The action parameters. /// - internal async Task Send(List actionParameters, CancellationToken cancellationToken) + internal async Task Send(List actionParameters, CancellationToken cancellationToken) { List> actionParamList = new List>(); @@ -238,9 +238,9 @@ namespace PocketSharp /// /// The action parameter. /// - internal async Task Send(ActionParameter actionParameter, CancellationToken cancellationToken) + internal async Task Send(PocketAction actionParameter, CancellationToken cancellationToken) { - return await Send(new List() { actionParameter }, cancellationToken); + return await Send(new List() { actionParameter }, cancellationToken); }