5 Commits

Author SHA1 Message Date
swcs da892067ad resolve conflicts; make GetAccessCode obsolete 2013-10-26 13:16:35 +02:00
swcs 3992a988fc Merge branch 'master' of github.com:ScottIsAFool/PocketSharp into ScottIsAFool-master 2013-10-26 13:05:14 +02:00
ScottIsAFool 2a98cfb0e4 Added new method to return username too 2013-10-25 15:49:47 +01:00
swcs 3057612872 update contributors 2013-10-25 15:22:13 +02:00
swcs 56180b5829 update contributors 2013-10-25 15:21:26 +02:00
8 changed files with 41 additions and 23 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")]
+3 -7
View File
@@ -67,13 +67,9 @@ You can find examples for Silverlight 5, WP8 and WPF in the `PocketSharp.Example
- [SgmlReader](https://github.com/MindTouch/SGMLReader) - converted to a PCL
## Contributors
| [![ceee](http://gravatar.com/avatar/9c61b1f4307425f12f05d3adb930ba66?s=70)](https://github.com/ceee "Tobias Klika") |
|---|
| [Tobias Klika @ceee](https://github.com/ceee) |
| [![ScottIsAFool](http://gravatar.com/avatar/6df656872a87b09a7470feb4867ed927?s=70)](https://github.com/ScottIsAFool "Scott Lovegrove") |
|---|
| [Scott Lovegrove @ScottIsAFool](https://github.com/ScottIsAFool) |
| [![ceee](http://gravatar.com/avatar/9c61b1f4307425f12f05d3adb930ba66?s=70)](https://github.com/ceee "Tobias Klika") | [![ScottIsAFool](http://gravatar.com/avatar/6df656872a87b09a7470feb4867ed927?s=70)](https://github.com/ScottIsAFool "Scott Lovegrove") |
|---|---|
| [ceee](https://github.com/ceee) | [ScottIsAFool](https://github.com/ScottIsAFool) |
## License