public bool[] Modify(PocketAction[] actions) { JObject jobject = new JObject { new JProperty("consumer_key", ConsumerKey), new JProperty("access_token", AccessToken) }; JArray jarray = new JArray(); foreach (PocketAction action in actions) { JObject jaction = new JObject { new JProperty("action", action.ActionName), new JProperty("item_id", action.ItemId) }; if (action.Parameters != null) { foreach (var key in action.Parameters.AllKeys) { jaction.Add(new JProperty(key, action.Parameters[key])); } } jarray.Add(jaction); } jobject.Add("actions", jarray); JObject response = Util.PostJson("https://getpocket.com/v3/send", jobject); //Add error handling List<bool> returnbools = new List<bool>(); foreach (var result in response["action_results"]) { returnbools.Add(Convert.ToBoolean(result.ToString())); } return returnbools.ToArray(); }
static void Main(string[] args) { Pocket pocket = new Pocket("Your Consumer Key", "Your Access Token"); //Add an article Item item = pocket.Add("http://en.wikipedia.org/wiki/Pocket_(application)"); //Retrieve all items List<Item> items = pocket.Retrieve(); //Retrieve all videos PocketParameterCollection retrieveParameters = new PocketParameterCollection(); retrieveParameters.Add("contentType", "video"); List<Item> conditionalItems = pocket.Retrieve(retrieveParameters); //Modify an item PocketAction action = new PocketAction("archive", "229279689", null); bool result = pocket.Modify(action); //Modify multiple items PocketAction action1 = new PocketAction("archive", "229279689", null); PocketAction action2 = new PocketAction("archive", "229279689", null); PocketAction[] actions = new PocketAction[] { action1, action2 }; bool[] results = pocket.Modify(actions); }
//Modify public bool Modify(PocketAction action) { PocketAction[] actions = new PocketAction[] { action }; return Modify(actions).FirstOrDefault(); }