diff --git a/PocketSharp.Console/Program.cs b/PocketSharp.Console/Program.cs
index ac02d47..a5c8aec 100644
--- a/PocketSharp.Console/Program.cs
+++ b/PocketSharp.Console/Program.cs
@@ -15,7 +15,6 @@ namespace PocketSharp.Console
// this apiKey is just for demonstration purposes
// please create your own application and retrieve it's key. It's a 1-step process ;-)
PocketClient client = new PocketClient("15396-f6f92101d72c8e270a6c9bb3");
- client.AccessCode = "a85134a7-243c-6656-ab82-97c901";
client.Retrieve(new RetrieveParameters()
{
diff --git a/PocketSharp/PocketClient.cs b/PocketSharp/PocketClient.cs
index d9dc1fc..045d7a0 100644
--- a/PocketSharp/PocketClient.cs
+++ b/PocketSharp/PocketClient.cs
@@ -49,23 +49,29 @@ namespace PocketSharp
///
/// The API key.
public PocketClient(string consumerKey)
- : this(defaultUrl, consumerKey) { }
+ : this(consumerKey, "") { }
///
/// Initializes a new instance of the class.
///
- /// The base URL.
/// The API key.
- public PocketClient(Uri baseUrl, string consumerKey)
+ /// Provide an access code if the user is already authenticated
+ public PocketClient(string consumerKey, string accessCode)
{
// assign public properties
- BaseUrl = baseUrl;
+ BaseUrl = defaultUrl;
ConsumerKey = consumerKey;
+ // assign access code if submitted
+ if (accessCode != "")
+ {
+ AccessCode = accessCode.ToString();
+ }
+
// initialize REST client
_restClient = new RestClient
{
- BaseUrl = baseUrl.ToString()
+ BaseUrl = BaseUrl.ToString()
};
// add default parameters to each request
@@ -73,7 +79,7 @@ namespace PocketSharp
// Pocket needs this specific Accept header :-S
_restClient.AddDefaultHeader("Accept", "*/*");
-
+
// defines the response format (according to the Pocket docs)
_restClient.AddDefaultHeader("X-Accept", "application/json");