diff --git a/PocketSharp.Console/Program.cs b/PocketSharp.Console/Program.cs
index 45c2bf6..a6589cd 100644
--- a/PocketSharp.Console/Program.cs
+++ b/PocketSharp.Console/Program.cs
@@ -1,5 +1,6 @@
using System;
using PocketSharp;
+using PocketSharp.Models.Authentification;
namespace PocketSharp.Console
{
@@ -15,6 +16,14 @@ namespace PocketSharp.Console
PocketClient client = new PocketClient("15396-f6f92101d72c8e270a6c9bb3");
client.Test();
+
+ System.Console.WriteLine(client.Test2());
+
+ System.Console.WriteLine("---------------------------------");
+
+ var result = client.Test3();
+
+ System.Console.WriteLine(string.Format("Code: {0}, Username: {1}", result.Code, result.Username));
System.Console.ReadKey();
}
diff --git a/PocketSharp/IPocketClient.cs b/PocketSharp/IPocketClient.cs
index 48d7c9a..49b01c0 100644
--- a/PocketSharp/IPocketClient.cs
+++ b/PocketSharp/IPocketClient.cs
@@ -16,16 +16,6 @@ namespace PocketSharp
///
string ConsumerKey { get; set; }
- ///
- /// Code retrieved on authentification
- ///
- string AuthCode { get; set; }
-
- ///
- /// Code retrieved on authentification-success
- ///
- string AccessCode { get; set; }
-
///
/// Makes a HTTP REST request to the API
///
diff --git a/PocketSharp/Models/Authentification/AcessCode.cs b/PocketSharp/Models/Authentification/AcessCode.cs
new file mode 100644
index 0000000..cf366b0
--- /dev/null
+++ b/PocketSharp/Models/Authentification/AcessCode.cs
@@ -0,0 +1,16 @@
+using RestSharp.Serializers;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace PocketSharp.Models.Authentification
+{
+ [DataContract]
+ public class AccessCode
+ {
+ [DataMember(Name = "access_token")]
+ public string Code { get; set; }
+
+ [DataMember]
+ public string Username { get; set; }
+ }
+}
diff --git a/PocketSharp/PocketClient.cs b/PocketSharp/PocketClient.cs
index 044e350..f0b4970 100644
--- a/PocketSharp/PocketClient.cs
+++ b/PocketSharp/PocketClient.cs
@@ -30,7 +30,7 @@ namespace PocketSharp
///
/// Code retrieved on authentification
///
- protected string AuthCode { get; set; }
+ protected string RequestCode { get; set; }
///
/// Code retrieved on authentification-success
@@ -102,7 +102,7 @@ namespace PocketSharp
- public bool Test()
+ public void Test()
{
var request = new RestRequest("oauth/request", Method.POST);
@@ -110,7 +110,23 @@ namespace PocketSharp
RequestCode rawResponse = Request(request);
- return true;
+ RequestCode = rawResponse.Code;
+ }
+
+ public string Test2()
+ {
+ return string.Format("https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}", RequestCode, Uri.EscapeDataString("http://ceecore.com"));
+ }
+
+ public AccessCode Test3()
+ {
+ var request = new RestRequest("oauth/authorize", Method.POST);
+
+ request.AddParameter("code", RequestCode);
+
+ AccessCode rawResponse = Request(request);
+
+ return rawResponse;
}
}
}
diff --git a/PocketSharp/PocketSharp.csproj b/PocketSharp/PocketSharp.csproj
index 20f8c3a..392676b 100644
--- a/PocketSharp/PocketSharp.csproj
+++ b/PocketSharp/PocketSharp.csproj
@@ -38,6 +38,7 @@
+
@@ -48,6 +49,7 @@
+