diff --git a/PocketSharp.Examples/PocketSharp.Silverlight/PocketSharp.Silverlight.csproj b/PocketSharp.Examples/PocketSharp.Silverlight/PocketSharp.Silverlight.csproj
index d7b1ae7..f4c9d27 100644
--- a/PocketSharp.Examples/PocketSharp.Silverlight/PocketSharp.Silverlight.csproj
+++ b/PocketSharp.Examples/PocketSharp.Silverlight/PocketSharp.Silverlight.csproj
@@ -112,6 +112,7 @@
PocketSharp is a C#.NET class library, that integrates the Pocket API v3
- Current version: 1.3.0
+ Current version: 1.4.0
+ (@ nuget)
Install-Package PocketSharp
@@ -124,16 +125,17 @@ using PocketSharp.Models;
Retrieve to Get + update IntelliSense documentation + add GetTags method
+ GetAccessCode can only be called with an existing req
Get list of all items:
-List<PocketItem> items = await _client.Retrieve();
-// equivalent to: await _client.RetrieveByFilter(RetrieveFilter.All)
+List<PocketItem> items = await _client.Get();
+// equivalent to: await _client.Get(RetrieveFilter.All)
Get a list with specific parameters (explanation in the Pocket Docs):
-List<PocketItem> items = await _client.Retrieve(
+List<PocketItem> items = await _client.Get(
State? state = null,
bool? favorite = null,
string tag = null,
@@ -210,15 +212,18 @@ Note that GetAccessCode can only be called with an existing req
int? offset = null
);
It's best to use parameters as named parameters, to avoid typing null values:
-List<PocketItem> items = await _client.Retrieve(count: 10, offset: 20, sort: Sort.oldest);
+List<PocketItem> items = await _client.Get(count: 10, offset: 20, sort: Sort.oldest);
Get item by ID:
-PocketItem item = await _client.Retrieve(1298198);
+PocketItem item = await _client.Get(1298198);
Find items by a tag:
List<PocketItem> items = await _client.SearchByTag("tutorial");
Find items by a search string:
List<PocketItem> items = await _client.Search("css");
+Get all tags:
+List<PocketTag> items = await _client.GetTags();
Get a filtered list:
-List<PocketItem> items = await _client.RetrieveByFilter(RetrieveFilter.Favorite);
+Get a filtered list:
+List<PocketItem> items = await _client.Get(RetrieveFilter.Favorite);
// returns favorites only
The RetrieveFilter Enum is specified as follows:
enum RetrieveFilter { All, Unread, Archive, Favorite, Article, Video, Image }
diff --git a/PocketSharp/Components/Get.cs b/PocketSharp/Components/Get.cs
new file mode 100644
index 0000000..bb7fba4
--- /dev/null
+++ b/PocketSharp/Components/Get.cs
@@ -0,0 +1,191 @@
+using PocketSharp.Models;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Linq;
+
+namespace PocketSharp
+{
+ ///
+ /// PocketClient
+ ///
+ public partial class PocketClient
+ {
+ ///
+ /// Retrieves items from pocket
+ /// with the given filters
+ ///
+ /// parameters, which are mapped to the officials from http://getpocket.com/developer/docs/v3/retrieve
+ ///
+ ///
+ public async Task> Get(
+ State? state = null,
+ bool? favorite = null,
+ string tag = null,
+ ContentType? contentType = null,
+ Sort? sort = null,
+ string search = null,
+ string domain = null,
+ DateTime? since = null,
+ int? count = null,
+ int? offset = null
+ )
+ {
+ RetrieveParameters parameters = new RetrieveParameters()
+ {
+ State = state,
+ Favorite = favorite,
+ Tag = tag,
+ ContentType = contentType,
+ Sort = sort,
+ DetailType = DetailType.complete,
+ Search = search,
+ Domain = domain,
+ Since = since,
+ Count = count,
+ Offset = offset
+ };
+
+ Retrieve response = await Request("get", parameters.Convert());
+
+ return response.Items;
+ }
+
+
+ ///
+ /// Retrieves an item by a given ID
+ /// Note: The Pocket API contains no method, which allows to retrieve a single item, so all items are retrieved and filtered locally by the ID.
+ ///
+ /// The item ID.
+ ///
+ ///
+ public async Task Get(int itemID)
+ {
+ List items = await Get(
+ state: State.all
+ );
+
+ return items.SingleOrDefault(item => item.ID == itemID);
+ }
+
+
+ ///
+ /// Retrieves all items by a given filter
+ ///
+ /// The filter.
+ ///
+ ///
+ public async Task> Get(RetrieveFilter filter)
+ {
+ RetrieveParameters parameters = new RetrieveParameters();
+
+ switch(filter)
+ {
+ case RetrieveFilter.Article:
+ parameters.ContentType = ContentType.article;
+ break;
+ case RetrieveFilter.Image:
+ parameters.ContentType = ContentType.image;
+ break;
+ case RetrieveFilter.Video:
+ parameters.ContentType = ContentType.video;
+ break;
+ case RetrieveFilter.Favorite:
+ parameters.Favorite = true;
+ break;
+ case RetrieveFilter.Unread:
+ parameters.State = State.unread;
+ break;
+ case RetrieveFilter.Archive:
+ parameters.State = State.archive;
+ break;
+ }
+
+ parameters.DetailType = DetailType.complete;
+
+ Retrieve response = await Request("get", parameters.Convert());
+
+ return response.Items;
+ }
+
+
+ ///
+ /// Retrieves all available tags.
+ /// Note: The Pocket API contains no method, which allows to retrieve all tags, so all items are retrieved and the associated tags extracted.
+ ///
+ ///
+ ///
+ public async Task> GetTags()
+ {
+ List items = await Get(
+ state: State.all
+ );
+
+ return items.Where(item => item.Tags != null)
+ .SelectMany(item => item.Tags)
+ .GroupBy(item => item.Name)
+ .Select(item => item.First())
+ .ToList();
+ }
+
+
+ ///
+ /// Retrieves items by tag
+ ///
+ /// The tag.
+ ///
+ ///
+ public async Task> SearchByTag(string tag)
+ {
+ return await Get(tag: tag);
+ }
+
+
+ ///
+ /// Retrieves items which match the specified search string in title or content
+ ///
+ /// The search string.
+ ///
+ ///
+ public async Task> Search(string searchString)
+ {
+ return await Get(search: searchString);
+ }
+ }
+
+
+ ///
+ /// Filter for simple retrieve requests
+ ///
+ public enum RetrieveFilter
+ {
+ ///
+ /// All types
+ ///
+ All,
+ ///
+ /// Only unread items
+ ///
+ Unread,
+ ///
+ /// Archived items
+ ///
+ Archive,
+ ///
+ /// Favorited items
+ ///
+ Favorite,
+ ///
+ /// Only articles
+ ///
+ Article,
+ ///
+ /// Only videos
+ ///
+ Video,
+ ///
+ /// Only images
+ ///
+ Image
+ }
+}
diff --git a/PocketSharp/Components/ModifyTags.cs b/PocketSharp/Components/ModifyTags.cs
index 292f997..86a1c1f 100644
--- a/PocketSharp/Components/ModifyTags.cs
+++ b/PocketSharp/Components/ModifyTags.cs
@@ -10,26 +10,6 @@ namespace PocketSharp
///
public partial class PocketClient
{
- ///
- /// Retrieves all available tags.
- /// Note: The Pocket API contains no method, which allows to retrieve all tags, so all items are retrieved and the associated tags extracted.
- ///
- ///
- ///
- public async Task> GetTags()
- {
- List items = await Get(
- state: State.all
- );
-
- return items.Where(item => item.Tags != null)
- .SelectMany(item => item.Tags)
- .GroupBy(item => item.Name)
- .Select(item => item.First())
- .ToList();
- }
-
-
///
/// Adds the specified tags to an item.
///
diff --git a/PocketSharp/PocketClient.cs b/PocketSharp/PocketClient.cs
index 86a9c5a..55081e8 100644
--- a/PocketSharp/PocketClient.cs
+++ b/PocketSharp/PocketClient.cs
@@ -144,7 +144,6 @@ namespace PocketSharp
Error = (object sender, ErrorEventArgs args) =>
{
throw new PocketException(String.Format("Parse error: {0}", args.ErrorContext.Error.Message));
- args.ErrorContext.Handled = true;
},
Converters =
{
diff --git a/PocketSharp/PocketSharp.csproj b/PocketSharp/PocketSharp.csproj
index e5a82be..ae33302 100644
--- a/PocketSharp/PocketSharp.csproj
+++ b/PocketSharp/PocketSharp.csproj
@@ -44,7 +44,7 @@
-
+
@@ -80,13 +80,13 @@
..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl4+win8+wp71\System.IO.dll
- ..\packages\Microsoft.Net.Http.2.2.13\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll
+ ..\packages\Microsoft.Net.Http.2.2.15\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll
- ..\packages\Microsoft.Net.Http.2.2.13\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll
+ ..\packages\Microsoft.Net.Http.2.2.15\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll
- ..\packages\Microsoft.Net.Http.2.2.13\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll
+ ..\packages\Microsoft.Net.Http.2.2.15\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll
..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl4+win8+wp71\System.Runtime.dll
diff --git a/PocketSharp/Properties/AssemblyInfo.cs b/PocketSharp/Properties/AssemblyInfo.cs
index 4129062..12d16dc 100644
--- a/PocketSharp/Properties/AssemblyInfo.cs
+++ b/PocketSharp/Properties/AssemblyInfo.cs
@@ -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("1.3.0")]
-[assembly: AssemblyFileVersion("1.3.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.4.0")]
+[assembly: AssemblyFileVersion("1.4.0")]
\ No newline at end of file
diff --git a/PocketSharp/packages.config b/PocketSharp/packages.config
index f24a6ad..4a510aa 100644
--- a/PocketSharp/packages.config
+++ b/PocketSharp/packages.config
@@ -3,6 +3,6 @@
-
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 05aaec5..10c8558 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,9 @@
**PocketSharp** is a C#.NET class library, that integrates the [Pocket API v3](http://getpocket.com/developer) and consists of 4 parts: [Authentication](#authentication), [Retrieve](#retrieve), [Modify](#modify) and [Add](#add).
-[pocketsharp.frontendplay.com](http://pocketsharp.frontendplay.com/)
+**Website:** [pocketsharp.frontendplay.com](http://pocketsharp.frontendplay.com/)
+
+**NuGet:** [nuget.org/packages/PocketSharp](https://www.nuget.org/packages/PocketSharp/)
## Install using NuGet
@@ -141,14 +143,14 @@ Without it you would always have to redo the authentication process.
Get list of all items:
```csharp
-List items = await _client.Retrieve();
-// equivalent to: await _client.RetrieveByFilter(RetrieveFilter.All)
+List items = await _client.Get();
+// equivalent to: await _client.Get(RetrieveFilter.All)
```
Get a list with specific parameters (explanation in the [Pocket Docs](http://getpocket.com/developer/docs/v3/retrieve)):
```csharp
-List items = await _client.Retrieve(
+List items = await _client.Get(
State? state = null,
bool? favorite = null,
string tag = null,
@@ -165,13 +167,13 @@ List items = await _client.Retrieve(
It's best to use parameters as _named parameters_, to avoid typing `null` values:
```csharp
-List items = await _client.Retrieve(count: 10, offset: 20, sort: Sort.oldest);
+List items = await _client.Get(count: 10, offset: 20, sort: Sort.oldest);
```
Get item by ID:
```csharp
-PocketItem item = await _client.Retrieve(1298198);
+PocketItem item = await _client.Get(1298198);
```
Find items by a tag:
@@ -186,10 +188,16 @@ Find items by a search string:
List items = await _client.Search("css");
```
+Get all tags:
+
+```csharp
+List items = await _client.GetTags();
+```
+
Get a filtered list:
```csharp
-List items = await _client.RetrieveByFilter(RetrieveFilter.Favorite);
+List items = await _client.Get(RetrieveFilter.Favorite);
// returns favorites only
```
@@ -271,16 +279,17 @@ Renames a tag for the specified item:
## Release History
-- 2013-09-19 v1.3.0 get Item by ID + tag modification bugfixes
-- 2013-09-18 v1.2.1 correct parameter conversion for DateTime and Boolean
-- 2013-09-17 v1.2.0 simplified retrieve methods
-- 2013-09-17 v1.1.0 fix modification requests
-- 2013-09-15 v1.0.0 convert to PCL & implement async
-- 2013-08-16 v0.3.2 tag modification fixed and full retrieval of items for Retrieve method
-- 2013-07-07 v0.3.1 authentication fixes
-- 2013-07-02 v0.3.0 update authentication process
-- 2013-06-27 v0.2.0 add, modify item & modify tags
-- 2013-06-26 v0.1.0 authentication & retrieve functionality
+- **1.4.0** (2013-09-21) rename `Retrieve` to `Get` + update IntelliSense documentation + add `GetTags` method
+- **1.3.0** (2013-09-19) get Item by ID + tag modification bugfixes
+- **1.2.1** (2013-09-18) correct parameter conversion for DateTime and Boolean
+- **1.2.0** (2013-09-17) simplified retrieve methods
+- **1.1.0** (2013-09-17) fix modification requests
+- **1.0.0** (2013-09-15) convert to PCL & implement async
+- **0.3.2** (2013-08-16) tag modification fixed and full retrieval of items for Retrieve method
+- **0.3.1** (2013-07-07) authentication fixes
+- **0.3.0** (2013-07-02) update authentication process
+- **0.2.0** (2013-06-27) add, modify item & modify tags
+- **0.1.0** (2013-06-26) authentication & retrieve functionality
## Dependencies