diff --git a/PocketSharp.Console/Program.cs b/PocketSharp.Console/Program.cs
index d4350ac..f6a7216 100644
--- a/PocketSharp.Console/Program.cs
+++ b/PocketSharp.Console/Program.cs
@@ -19,18 +19,28 @@ namespace PocketSharp.Console
consumerKey: "15396-f6f92101d72c8e270a6c9bb3"
);
- Uri redirect = client.Authenticate(new Uri("http://example.com"));
+ //Uri redirect = client.Authenticate(new Uri("http://example.com"));
- System.Console.WriteLine(redirect.ToString());
+ //System.Console.WriteLine(redirect.ToString());
- System.Console.WriteLine("---------------------------------");
- System.Console.WriteLine("Press Any key after you've authenticated the user via the given URI");
+ //System.Console.WriteLine("---------------------------------");
+ //System.Console.WriteLine("Press Any key after you've authenticated the user via the given URI");
- System.Console.ReadKey();
+ //System.Console.ReadKey();
+ //System.Console.WriteLine("---------------------------------");
+
+ //System.Console.WriteLine(client.GetAccessCode());
+
+ client.Search("css").ForEach(delegate(PocketItem item)
+ {
+ System.Console.WriteLine(item.ID + " ::: " + item.FullTitle);
+ });
+
System.Console.WriteLine("---------------------------------");
- System.Console.WriteLine(client.GetAccessCode());
+ client.Archive(330361896);
+
System.Console.ReadKey();
}
diff --git a/PocketSharp/Components/Authentification.cs b/PocketSharp/Components/Authentification.cs
index a7ecc23..e2b1eca 100644
--- a/PocketSharp/Components/Authentification.cs
+++ b/PocketSharp/Components/Authentification.cs
@@ -16,7 +16,7 @@ namespace PocketSharp
///
public Uri Authenticate(Uri callbackUri)
{
- RequestCode response = GetResource("oauth/request", new List()
+ RequestCode response = Get("oauth/request", new List()
{
new Parameter() { Name = "redirect_uri", Value = callbackUri, Type = ParameterType.GetOrPost }
});
@@ -41,7 +41,7 @@ namespace PocketSharp
throw new APIException("Authenticate the user first to receive a request_code");
}
- AccessCode response = GetResource("oauth/authorize", new List()
+ AccessCode response = Get("oauth/authorize", new List()
{
new Parameter() { Name = "code", Value = RequestCode, Type = ParameterType.GetOrPost }
});
diff --git a/PocketSharp/Components/Modify.cs b/PocketSharp/Components/Modify.cs
new file mode 100644
index 0000000..c7ba7da
--- /dev/null
+++ b/PocketSharp/Components/Modify.cs
@@ -0,0 +1,18 @@
+using PocketSharp.Models;
+using System.Collections.Generic;
+
+namespace PocketSharp
+{
+ public partial class PocketClient
+ {
+ public bool Archive(int itemID)
+ {
+ List actions = new List()
+ {
+ new ActionParameter() { Action = "archive", ID = itemID }
+ };
+
+ return Put("send", actions).Status == 1;
+ }
+ }
+}
diff --git a/PocketSharp/Components/Retrieve.cs b/PocketSharp/Components/Retrieve.cs
index e16dcb8..4287edb 100644
--- a/PocketSharp/Components/Retrieve.cs
+++ b/PocketSharp/Components/Retrieve.cs
@@ -13,7 +13,7 @@ namespace PocketSharp
public List Retrieve(RetrieveParameters parameters)
{
ExpectAuthentification();
- return GetResource("get", parameters.Convert()).Items;
+ return Get("get", parameters.Convert()).Items;
}
@@ -50,7 +50,7 @@ namespace PocketSharp
break;
}
- return GetResource("get", parameters.Convert()).Items;
+ return Get("get", parameters.Convert()).Items;
}
@@ -66,7 +66,7 @@ namespace PocketSharp
{
Tag = tag
};
- return GetResource("get", parameters.Convert()).Items;
+ return Get("get", parameters.Convert()).Items;
}
@@ -82,7 +82,7 @@ namespace PocketSharp
{
Search = searchString
};
- return GetResource("get", parameters.Convert()).Items;
+ return Get("get", parameters.Convert()).Items;
}
}
diff --git a/PocketSharp/Models/Modify.cs b/PocketSharp/Models/Modify.cs
new file mode 100644
index 0000000..1361472
--- /dev/null
+++ b/PocketSharp/Models/Modify.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace PocketSharp.Models
+{
+ [DataContract]
+ class Modify : ResponseBase
+ {
+ [DataMember(Name = "action_results")]
+ public bool[] ActionResults { get; set; }
+
+ [DataMember(Name = "status")]
+ public int Status { get; set; }
+ }
+}
diff --git a/PocketSharp/Models/Parameters/ActionParameter.cs b/PocketSharp/Models/Parameters/ActionParameter.cs
new file mode 100644
index 0000000..7c331cb
--- /dev/null
+++ b/PocketSharp/Models/Parameters/ActionParameter.cs
@@ -0,0 +1,32 @@
+using RestSharp;
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace PocketSharp.Models
+{
+ public class ActionParameter : ParameterBase
+ {
+ public string Action { get; set; }
+
+ public int ID { get; set; }
+
+ public DateTime? Time { get; set; }
+
+
+ public object Convert()
+ {
+ Dictionary parameters = new Dictionary
+ {
+ { "item_id", ID.ToString() },
+ { "action", Action }
+ };
+
+ if(Time != null)
+ parameters.Add( "time", (int)((DateTime)Time - new DateTime(1970, 1, 1)).TotalSeconds );
+
+ return parameters;
+ }
+ }
+}
diff --git a/PocketSharp/Models/Parameters/ModifyParameters.cs b/PocketSharp/Models/Parameters/ModifyParameters.cs
new file mode 100644
index 0000000..8d411a3
--- /dev/null
+++ b/PocketSharp/Models/Parameters/ModifyParameters.cs
@@ -0,0 +1,28 @@
+using RestSharp;
+using ServiceStack.Text;
+using System;
+using System.Collections.Generic;
+
+namespace PocketSharp.Models
+{
+ public class ModifyParameters : ParameterBase
+ {
+ public List Actions { get; set; }
+
+
+ public List Convert()
+ {
+ List parameters = new List();
+ List