diff --git a/PocketSharp.Console/Program.cs b/PocketSharp.Console/Program.cs index dd060a5..d04964f 100644 --- a/PocketSharp.Console/Program.cs +++ b/PocketSharp.Console/Program.cs @@ -41,6 +41,7 @@ namespace PocketSharp.Console System.Console.WriteLine("---------------------------------"); client.Archive(330361896); + client.Favorite(330361896); System.Console.ReadKey(); diff --git a/PocketSharp/Components/Modify.cs b/PocketSharp/Components/Modify.cs index 047315f..b646900 100644 --- a/PocketSharp/Components/Modify.cs +++ b/PocketSharp/Components/Modify.cs @@ -12,13 +12,51 @@ namespace PocketSharp /// public bool Archive(int itemID) { - ActionParameter action = new ActionParameter() - { - Action = "archive", - ID = itemID - }; + return PutAction(itemID, "archive"); + } - return Put("send", action).Status == 1; + + /// + /// Un-archives the specified item ID. + /// + /// The item ID. + /// + public bool Unarchive(int itemID) + { + return PutAction(itemID, "readd"); + } + + + /// + /// Favorites the specified item ID. + /// + /// The item ID. + /// + public bool Favorite(int itemID) + { + return PutAction(itemID, "favorite"); + } + + + /// + /// Un-favorites the specified item ID. + /// + /// The item ID. + /// + public bool Unfavorite(int itemID) + { + return PutAction(itemID, "unfavorite"); + } + + + /// + /// Deletes the specified item ID. + /// + /// The item ID. + /// + public bool Delete(int itemID) + { + return PutAction(itemID, "delete"); } } } diff --git a/PocketSharp/PocketClient.cs b/PocketSharp/PocketClient.cs index 6bbe0d5..1309f7a 100644 --- a/PocketSharp/PocketClient.cs +++ b/PocketSharp/PocketClient.cs @@ -198,6 +198,24 @@ namespace PocketSharp } + /// + /// Puts an action + /// + /// The item ID. + /// The action. + /// + protected bool PutAction(int itemID, string action) + { + ActionParameter actionParam = new ActionParameter() + { + Action = action, + ID = itemID + }; + + return Put("send", actionParam).Status == 1; + } + + /// /// Validates the response. ///