resolve conflicts; make GetAccessCode obsolete

This commit is contained in:
2013-10-26 13:16:35 +02:00
7 changed files with 38 additions and 16 deletions
+7 -2
View File
@@ -1,8 +1,13 @@
### 2.2.0 (2013-10-26)
- Made `GetAccessCode` obsolete
- Return username after authentication with `GetUser` (thanks to [ScottIsAFool](https://github.com/ScottIsAFool))
### 2.1.0 (2013-10-25)
- Rename `Statistics()` to `GetUserStatistics()`
- Made `CallbackUri` public (thanks to @ScottIsAFool)
- Added Fody/PropertyChanged (thanks to @ScottIsAFool)
- Made `CallbackUri` public (thanks to [ScottIsAFool](https://github.com/ScottIsAFool))
- Added Fody/PropertyChanged (thanks to [ScottIsAFool](https://github.com/ScottIsAFool))
- Method `GetUsageLimits()` to retrieve API usage limits
- Add PORTABLE constant to SgmlReader
+22 -7
View File
@@ -65,36 +65,51 @@ namespace PocketSharp
/// <summary>
/// Requests the access code after authentication
/// The access code has to permanently be stored within the users session, and should be added as a parameter for all future PocketClient initializations.
/// The access code has to permanently be stored within the users session, and should be passed in the constructor for all future PocketClient initializations.
/// </summary>
/// <param name="requestCode">The requestCode. If no requestCode is supplied, the property from the PocketClient intialization is used.</param>
/// <returns>The permanent access code, which is used to authenticate the user with the application</returns>
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
/// <exception cref="PocketException"></exception>
[Obsolete("Please use GetUser instead")]
public async Task<string> GetAccessCode(string requestCode = null)
{
await GetUser(requestCode);
return AccessCode;
}
/// <summary>
/// Requests the access code and username after authentication
/// The access code has to permanently be stored within the users session, and should be passed in the constructor for all future PocketClient initializations.
/// </summary>
/// <param name="requestCode">The request code.</param>
/// <returns>The authenticated user</returns>
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
public async Task<PocketUser> GetUser(string requestCode = null)
{
// check if request code is available
if(RequestCode == null && requestCode == null)
if (RequestCode == null && requestCode == null)
{
throw new NullReferenceException("Call GetRequestCode() first to receive a request_code");
}
// override property with given param if available
if(requestCode != null)
if (requestCode != null)
{
RequestCode = requestCode;
}
// do request
AccessCode response = await Request<AccessCode>("oauth/authorize", new Dictionary<string, string>()
{
{ "code", RequestCode }
PocketUser response = await Request<PocketUser>("oauth/authorize", new Dictionary<string, string>()
{
{"code", RequestCode}
}, false);
// save code to client
AccessCode = response.Code;
return AccessCode;
return response;
}
+1 -1
View File
@@ -25,7 +25,7 @@ namespace PocketSharp
/// </summary>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
[Obsolete("Please use GetUserStatistics")]
[Obsolete("Please use GetUserStatistics instead")]
public async Task<PocketStatistics> Statistics()
{
return await GetUserStatistics();
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using PropertyChanged;
namespace PocketSharp.Models
{
@@ -6,7 +7,8 @@ namespace PocketSharp.Models
/// Access Code
/// </summary>
[JsonObject]
internal class AccessCode
[ImplementPropertyChanged]
public class PocketUser
{
/// <summary>
/// Gets or sets the code.
@@ -23,7 +25,7 @@ namespace PocketSharp.Models
/// <value>
/// The username.
/// </value>
[JsonProperty]
[JsonProperty("username")]
public string Username { get; set; }
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ namespace PocketSharp
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Encoding", "gzip,deflate");
// add user agent (default for Opera with PocketSharp identifier appended)
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.4 Safari/537.36 OPR/18.0.1284.2 PocketSharp/2.0");
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.4 Safari/537.36 OPR/18.0.1284.2 PocketSharp/2.2");
}
+1 -1
View File
@@ -63,7 +63,7 @@
<Compile Include="Models\PocketItem.cs" />
<Compile Include="Models\PocketTag.cs" />
<Compile Include="Models\PocketVideo.cs" />
<Compile Include="Models\Response\AccessCode.cs" />
<Compile Include="Models\PocketUser.cs" />
<Compile Include="Models\Response\Add.cs" />
<Compile Include="Models\Response\Modify.cs" />
<Compile Include="Models\Response\RequestCode.cs" />
+2 -2
View File
@@ -25,5 +25,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]