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); }
public Item Add(string url, PocketParameterCollection optionalParameters) { JObject jobject = new JObject { new JProperty("consumer_key", ConsumerKey), new JProperty("access_token", AccessToken), new JProperty("url", url)}; if (optionalParameters != null) { foreach (var key in optionalParameters.AllKeys) { jobject.Add(new JProperty(key, optionalParameters[key])); } } JObject response = Util.PostJson("https://getpocket.com/v3/add", jobject); //Add Error Handling Item item = new Item(response["item"].ToObject<JObject>()); return item; }
public List<Item> Retrieve(PocketParameterCollection optionalParameters) { JObject jobject = new JObject { new JProperty("consumer_key", ConsumerKey), new JProperty("access_token", AccessToken) }; if (optionalParameters != null) { foreach (var key in optionalParameters.AllKeys) { jobject.Add(new JProperty(key, optionalParameters[key])); } } JObject response = Util.PostJson("https://getpocket.com/v3/get", jobject); List<Item> items = new List<Item>(); //Add Error Handling foreach (var itemString in response["list"]) { JObject itemJObject = itemString.First.ToObject<JObject>(); Item item = new Item(itemJObject); items.Add(item); } return items; }
public PocketAction(string actionName, string itemId, PocketParameterCollection parameters) { ActionName = actionName; ItemId = itemId; Parameters = parameters; }