diff --git a/PocketSharp/Components/Add.cs b/PocketSharp/Components/Add.cs
index 7622c72..815013a 100644
--- a/PocketSharp/Components/Add.cs
+++ b/PocketSharp/Components/Add.cs
@@ -1,5 +1,6 @@
using PocketSharp.Models;
using System;
+using System.Threading.Tasks;
namespace PocketSharp
{
@@ -16,7 +17,7 @@ namespace PocketSharp
/// This can be included for cases where an item does not have a title, which is typical for image or PDF URLs. If Pocket detects a title from the content of the page, this parameter will be ignored.
/// If you are adding Pocket support to a Twitter client, please send along a reference to the tweet status id. This allows Pocket to show the original tweet alongside the article.
///
- public PocketItem Add(Uri uri, string[] tags = null, string title = null, string tweetID = null)
+ public async Task Add(Uri uri, string[] tags = null, string title = null, string tweetID = null)
{
AddParameters parameters = new AddParameters()
{
@@ -25,7 +26,7 @@ namespace PocketSharp
Title = title,
TweetID = tweetID
};
- return Get("add", parameters.Convert(), true).Item;
+ return await Request("add", parameters.Convert(), true).Item;
}
@@ -34,9 +35,9 @@ namespace PocketSharp
///
/// The URL of the item you want to save
///
- public PocketItem Add(Uri uri)
+ public async Task Add(Uri uri)
{
- return Add(uri, null, null, null);
+ return await Add(uri, null, null, null);
}
}
}
diff --git a/PocketSharp/Components/Authentification.cs b/PocketSharp/Components/Authentification.cs
index 10f7605..97e46c3 100644
--- a/PocketSharp/Components/Authentification.cs
+++ b/PocketSharp/Components/Authentification.cs
@@ -1,5 +1,6 @@
using PocketSharp.Models;
using System;
+using System.Threading.Tasks;
namespace PocketSharp
{
@@ -12,7 +13,7 @@ namespace PocketSharp
/// Retrieves the requestCode from Pocket.
///
///
- public string GetRequestCode()
+ public async Task GetRequestCode()
{
// check if request code is available
if (CallbackUri == null)
@@ -21,7 +22,7 @@ namespace PocketSharp
}
// do request
- RequestCode response = Get("oauth/request", Utilities.CreateParamInList("redirect_uri", CallbackUri));
+ RequestCode response = await Request("oauth/request", Utilities.CreateParamInList("redirect_uri", CallbackUri));
// save code to client
RequestCode = response.Code;
@@ -58,7 +59,7 @@ namespace PocketSharp
/// Requests the access code after authentification
///
///
- public string GetAccessCode(string requestCode = null)
+ public async Task GetAccessCode(string requestCode = null)
{
// check if request code is available
if(RequestCode == null && requestCode == null)
@@ -73,7 +74,7 @@ namespace PocketSharp
}
// do request
- AccessCode response = Get("oauth/authorize", Utilities.CreateParamInList("code", RequestCode));
+ AccessCode response = await Request("oauth/authorize", Utilities.CreateParamInList("code", RequestCode));
// save code to client
AccessCode = response.Code;
diff --git a/PocketSharp/Components/Modify.cs b/PocketSharp/Components/Modify.cs
index 3d9502b..050a1c6 100644
--- a/PocketSharp/Components/Modify.cs
+++ b/PocketSharp/Components/Modify.cs
@@ -1,4 +1,5 @@
using PocketSharp.Models;
+using System.Threading.Tasks;
namespace PocketSharp
{
@@ -12,9 +13,9 @@ namespace PocketSharp
///
/// The item ID.
///
- public bool Archive(int itemID)
+ public async Task Archive(int itemID)
{
- return PutSendActionDefault(itemID, "archive");
+ return await PutSendActionDefault(itemID, "archive");
}
@@ -23,9 +24,9 @@ namespace PocketSharp
///
/// The item.
///
- public bool Archive(PocketItem item)
+ public async Task Archive(PocketItem item)
{
- return Archive(item.ID);
+ return await Archive(item.ID);
}
@@ -34,9 +35,9 @@ namespace PocketSharp
///
/// The item ID.
///
- public bool Unarchive(int itemID)
+ public async Task Unarchive(int itemID)
{
- return PutSendActionDefault(itemID, "readd");
+ return await PutSendActionDefault(itemID, "readd");
}
@@ -45,9 +46,9 @@ namespace PocketSharp
///
/// The item.
///
- public bool Unarchive(PocketItem item)
+ public async Task Unarchive(PocketItem item)
{
- return Unarchive(item.ID);
+ return await Unarchive(item.ID);
}
@@ -56,9 +57,9 @@ namespace PocketSharp
///
/// The item ID.
///
- public bool Favorite(int itemID)
+ public async Task Favorite(int itemID)
{
- return PutSendActionDefault(itemID, "favorite");
+ return await PutSendActionDefault(itemID, "favorite");
}
@@ -67,9 +68,9 @@ namespace PocketSharp
///
/// The item.
///
- public bool Favorite(PocketItem item)
+ public async Task Favorite(PocketItem item)
{
- return Favorite(item.ID);
+ return await Favorite(item.ID);
}
@@ -78,9 +79,9 @@ namespace PocketSharp
///
/// The item ID.
///
- public bool Unfavorite(int itemID)
+ public async Task Unfavorite(int itemID)
{
- return PutSendActionDefault(itemID, "unfavorite");
+ return await PutSendActionDefault(itemID, "unfavorite");
}
@@ -89,9 +90,9 @@ namespace PocketSharp
///
/// The item.
///
- public bool Unfavorite(PocketItem item)
+ public async Task Unfavorite(PocketItem item)
{
- return Unfavorite(item.ID);
+ return await Unfavorite(item.ID);
}
@@ -100,9 +101,9 @@ namespace PocketSharp
///
/// The item ID.
///
- public bool Delete(int itemID)
+ public async Task Delete(int itemID)
{
- return PutSendActionDefault(itemID, "delete");
+ return await PutSendActionDefault(itemID, "delete");
}
@@ -111,9 +112,9 @@ namespace PocketSharp
///
/// The item.
///
- public bool Delete(PocketItem item)
+ public async Task Delete(PocketItem item)
{
- return Delete(item.ID);
+ return await Delete(item.ID);
}
@@ -123,9 +124,9 @@ namespace PocketSharp
/// The item ID.
/// The action.
///
- protected bool PutSendActionDefault(int itemID, string action)
+ protected async Task PutSendActionDefault(int itemID, string action)
{
- return PutSendAction(new ActionParameter()
+ return await PutSendAction(new ActionParameter()
{
Action = action,
ID = itemID
diff --git a/PocketSharp/Components/ModifyTags.cs b/PocketSharp/Components/ModifyTags.cs
index d5bec75..cc2361e 100644
--- a/PocketSharp/Components/ModifyTags.cs
+++ b/PocketSharp/Components/ModifyTags.cs
@@ -1,4 +1,5 @@
using PocketSharp.Models;
+using System.Threading.Tasks;
namespace PocketSharp
{
@@ -13,9 +14,9 @@ namespace PocketSharp
/// The item ID.
/// The tags.
///
- public bool AddTags(int itemID, string[] tags)
+ public async Task AddTags(int itemID, string[] tags)
{
- return PutSendActionForTags(itemID, "tags_add", tags);
+ return await PutSendActionForTags(itemID, "tags_add", tags);
}
@@ -25,9 +26,9 @@ namespace PocketSharp
/// The item.
/// The tags.
///
- public bool AddTags(PocketItem item, string[] tags)
+ public async Task AddTags(PocketItem item, string[] tags)
{
- return AddTags(item.ID, tags);
+ return await AddTags(item.ID, tags);
}
@@ -37,9 +38,9 @@ namespace PocketSharp
/// The item ID.
/// The tags.
///
- public bool RemoveTags(int itemID, string[] tags)
+ public async Task RemoveTags(int itemID, string[] tags)
{
- return PutSendActionForTags(itemID, "tags_remove", tags);
+ return await PutSendActionForTags(itemID, "tags_remove", tags);
}
@@ -49,9 +50,9 @@ namespace PocketSharp
/// The item.
/// The tags.
///
- public bool RemoveTags(PocketItem item, string[] tags)
+ public async Task RemoveTags(PocketItem item, string[] tags)
{
- return RemoveTags(item.ID, tags);
+ return await RemoveTags(item.ID, tags);
}
@@ -60,9 +61,9 @@ namespace PocketSharp
///
/// The item ID.
///
- public bool RemoveTags(int itemID)
+ public async Task RemoveTags(int itemID)
{
- return PutSendActionDefault(itemID, "tags_clear");
+ return await PutSendActionDefault(itemID, "tags_clear");
}
@@ -71,9 +72,9 @@ namespace PocketSharp
///
/// The item.
///
- public bool RemoveTags(PocketItem item)
+ public async Task RemoveTags(PocketItem item)
{
- return RemoveTags(item.ID);
+ return await RemoveTags(item.ID);
}
@@ -83,9 +84,9 @@ namespace PocketSharp
/// The item ID.
/// The tags.
///
- public bool ReplaceTags(int itemID, string[] tags)
+ public async Task ReplaceTags(int itemID, string[] tags)
{
- return PutSendActionForTags(itemID, "tags_replace", tags);
+ return await PutSendActionForTags(itemID, "tags_replace", tags);
}
@@ -95,9 +96,9 @@ namespace PocketSharp
/// The item.
/// The tags.
///
- public bool ReplaceTags(PocketItem item, string[] tags)
+ public async Task ReplaceTags(PocketItem item, string[] tags)
{
- return ReplaceTags(item.ID, tags);
+ return await ReplaceTags(item.ID, tags);
}
@@ -108,9 +109,9 @@ namespace PocketSharp
/// The old tag.
/// The new tag name.
///
- public bool RenameTag(int itemID, string oldTag, string newTag)
+ public async Task RenameTag(int itemID, string oldTag, string newTag)
{
- return PutSendAction(new ActionParameter()
+ return await PutSendAction(new ActionParameter()
{
Action = "tag_rename",
ID = itemID,
@@ -127,9 +128,9 @@ namespace PocketSharp
/// The old tag.
/// The new tag name.
///
- public bool RenameTag(PocketItem item, string oldTag, string newTag)
+ public async Task RenameTag(PocketItem item, string oldTag, string newTag)
{
- return RenameTag(item.ID, oldTag, newTag);
+ return await RenameTag(item.ID, oldTag, newTag);
}
@@ -140,9 +141,9 @@ namespace PocketSharp
/// The action.
/// The tags.
///
- protected bool PutSendActionForTags(int itemID, string action, string[] tags)
+ protected async Task PutSendActionForTags(int itemID, string action, string[] tags)
{
- return PutSendAction(new ActionParameter()
+ return await PutSendAction(new ActionParameter()
{
Action = action,
ID = itemID,
diff --git a/PocketSharp/Components/Retrieve.cs b/PocketSharp/Components/Retrieve.cs
index a4d5f02..3595480 100644
--- a/PocketSharp/Components/Retrieve.cs
+++ b/PocketSharp/Components/Retrieve.cs
@@ -1,5 +1,6 @@
using PocketSharp.Models;
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace PocketSharp
{
@@ -13,9 +14,9 @@ namespace PocketSharp
///
/// parameters, which are mapped to the officials from http://getpocket.com/developer/docs/v3/retrieve
///
- public List Retrieve(RetrieveParameters parameters)
+ public async Task> Retrieve(RetrieveParameters parameters)
{
- return Get("get", parameters.Convert(), true).Items;
+ return await Request("get", parameters.Convert(), true).Items;
}
@@ -24,7 +25,7 @@ namespace PocketSharp
///
/// The filter.
///
- public List Retrieve(RetrieveFilter filter = RetrieveFilter.All)
+ public async Task> Retrieve(RetrieveFilter filter = RetrieveFilter.All)
{
RetrieveParameters parameters = new RetrieveParameters();
@@ -52,7 +53,7 @@ namespace PocketSharp
parameters.DetailType = DetailType.complete;
- return Get("get", parameters.Convert(), true).Items;
+ return await Request("get", parameters.Convert(), true).Items;
}
@@ -61,14 +62,14 @@ namespace PocketSharp
///
/// The tag.
///
- public List SearchByTag(string tag)
+ public async Task> SearchByTag(string tag)
{
RetrieveParameters parameters = new RetrieveParameters()
{
Tag = tag,
DetailType = DetailType.complete
};
- return Get("get", parameters.Convert(), true).Items;
+ return await Request("get", parameters.Convert(), true).Items;
}
@@ -77,14 +78,14 @@ namespace PocketSharp
///
/// The search string.
///
- public List Search(string searchString)
+ public async Task> Search(string searchString)
{
RetrieveParameters parameters = new RetrieveParameters()
{
Search = searchString,
DetailType = DetailType.complete
};
- return Get("get", parameters.Convert(), true).Items;
+ return await Request("get", parameters.Convert(), true).Items;
}
}