update method documentation

This commit is contained in:
2013-09-21 00:06:56 +02:00
parent a8cc4c14de
commit f8eaf47f80
5 changed files with 63 additions and 26 deletions
+4 -2
View File
@@ -16,7 +16,8 @@ namespace PocketSharp
/// <param name="tags">A comma-separated list of tags to apply to the item</param>
/// <param name="title">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.</param>
/// <param name="tweetID">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.</param>
/// <returns></returns>
/// <returns>A simple representation of the saved item which doesn't contain all data (is only returned by calling the Retrieve method)</returns>
/// <exception cref="PocketException"></exception>
public async Task<PocketItem> Add(Uri uri, string[] tags = null, string title = null, string tweetID = null)
{
AddParameters parameters = new AddParameters()
@@ -37,7 +38,8 @@ namespace PocketSharp
/// Adds a new item to pocket
/// </summary>
/// <param name="uri">The URL of the item you want to save</param>
/// <returns></returns>
/// <returns>A simple representation of the saved item which doesn't contain all data (is only returned by calling the Retrieve method)</returns>
/// <exception cref="PocketException"></exception>
public async Task<PocketItem> Add(Uri uri)
{
return await Add(uri, null);
+15 -8
View File
@@ -11,15 +11,17 @@ namespace PocketSharp
public partial class PocketClient
{
/// <summary>
/// Retrieves the requestCode from Pocket.
/// Retrieves the requestCode from Pocket, which is used to generate the Authentication URI to authenticate the user
/// </summary>
/// <returns></returns>
/// <exception cref="System.NullReferenceException">Authentication methods need a callbackUri on initialization of the PocketClient class</exception>
/// <exception cref="PocketException"></exception>
public async Task<string> GetRequestCode()
{
// check if request code is available
if (CallbackUri == null)
{
throw new PocketException("Authentication methods need a callbackUri on initialization of the PocketClient class");
throw new NullReferenceException("Authentication methods need a callbackUri on initialization of the PocketClient class");
}
// do request
@@ -39,14 +41,15 @@ namespace PocketSharp
/// <summary>
/// Generate Authentication URI from requestCode
/// </summary>
/// <param name="requestCode">The requestCode.</param>
/// <returns></returns>
/// <param name="requestCode">The requestCode. If no requestCode is supplied, the property from the PocketClient intialization is used.</param>
/// <returns>A valid URI to redirect the user to.</returns>
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
public Uri GenerateAuthenticationUri(string requestCode = null)
{
// check if request code is available
if(RequestCode == null && requestCode == null)
{
throw new PocketException("Call GetRequestCode() first to receive a request_code");
throw new NullReferenceException("Call GetRequestCode() first to receive a request_code");
}
// override property with given param if available
@@ -60,15 +63,19 @@ namespace PocketSharp
/// <summary>
/// Requests the access code after authentification
/// 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.
/// </summary>
/// <returns></returns>
/// <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>
public async Task<string> GetAccessCode(string requestCode = null)
{
// check if request code is available
if(RequestCode == null && requestCode == null)
{
throw new PocketException("Call GetRequestCode() first to receive a request_code");
throw new NullReferenceException("Call GetRequestCode() first to receive a request_code");
}
// override property with given param if available
+9
View File
@@ -14,6 +14,7 @@ namespace PocketSharp
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Archive(int itemID)
{
return await SendDefault(itemID, "archive");
@@ -25,6 +26,7 @@ namespace PocketSharp
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Archive(PocketItem item)
{
return await Archive(item.ID);
@@ -36,6 +38,7 @@ namespace PocketSharp
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Unarchive(int itemID)
{
return await SendDefault(itemID, "readd");
@@ -47,6 +50,7 @@ namespace PocketSharp
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Unarchive(PocketItem item)
{
return await Unarchive(item.ID);
@@ -58,6 +62,7 @@ namespace PocketSharp
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Favorite(int itemID)
{
return await SendDefault(itemID, "favorite");
@@ -69,6 +74,7 @@ namespace PocketSharp
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Favorite(PocketItem item)
{
return await Favorite(item.ID);
@@ -80,6 +86,7 @@ namespace PocketSharp
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Unfavorite(int itemID)
{
return await SendDefault(itemID, "unfavorite");
@@ -91,6 +98,7 @@ namespace PocketSharp
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Unfavorite(PocketItem item)
{
return await Unfavorite(item.ID);
@@ -102,6 +110,7 @@ namespace PocketSharp
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> Delete(int itemID)
{
return await SendDefault(itemID, "delete");
+24 -12
View File
@@ -9,11 +9,12 @@ namespace PocketSharp
public partial class PocketClient
{
/// <summary>
/// Adds the specified tags.
/// Adds the specified tags to an item.
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <param name="tags">The tags.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> AddTags(int itemID, string[] tags)
{
return await SendTags(itemID, "tags_add", tags);
@@ -21,11 +22,12 @@ namespace PocketSharp
/// <summary>
/// Adds the specified tags.
/// Adds the specified tags to an item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="tags">The tags.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> AddTags(PocketItem item, string[] tags)
{
return await AddTags(item.ID, tags);
@@ -33,11 +35,12 @@ namespace PocketSharp
/// <summary>
/// Removes the specified tags.
/// Removes the specified tags from an item.
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <param name="tags">The tags.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> RemoveTags(int itemID, string[] tags)
{
return await SendTags(itemID, "tags_remove", tags);
@@ -45,11 +48,12 @@ namespace PocketSharp
/// <summary>
/// Removes the specified tags.
/// Removes the specified tags from an item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="tags">The tag.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> RemoveTags(PocketItem item, string[] tags)
{
return await RemoveTags(item.ID, tags);
@@ -57,11 +61,12 @@ namespace PocketSharp
/// <summary>
/// Removes a tag.
/// Removes a tag from an item.
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <param name="tags">The tag.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> RemoveTag(int itemID, string tag)
{
return await SendTags(itemID, "tags_remove", new string[] { tag });
@@ -69,11 +74,12 @@ namespace PocketSharp
/// <summary>
/// Removes a tag.
/// Removes a tag from an item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="tags">The tags.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> RemoveTag(PocketItem item, string tag)
{
return await RemoveTag(item.ID, tag);
@@ -81,10 +87,11 @@ namespace PocketSharp
/// <summary>
/// Clears all tags.
/// Clears all tags from an item.
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> RemoveTags(int itemID)
{
return await SendDefault(itemID, "tags_clear");
@@ -92,10 +99,11 @@ namespace PocketSharp
/// <summary>
/// Clears all tags.
/// Clears all tags from an item.
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> RemoveTags(PocketItem item)
{
return await RemoveTags(item.ID);
@@ -103,11 +111,12 @@ namespace PocketSharp
/// <summary>
/// Replaces all existing tags with the given tags.
/// Replaces all existing tags with the given tags in an item.
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <param name="tags">The tags.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> ReplaceTags(int itemID, string[] tags)
{
return await SendTags(itemID, "tags_replace", tags);
@@ -115,11 +124,12 @@ namespace PocketSharp
/// <summary>
/// Replaces all existing tags with new ones.
/// Replaces all existing tags with the given new ones in an item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="tags">The tags.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> ReplaceTags(PocketItem item, string[] tags)
{
return await ReplaceTags(item.ID, tags);
@@ -127,12 +137,13 @@ namespace PocketSharp
/// <summary>
/// Renames a tag.
/// Renames a tag in an item.
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <param name="oldTag">The old tag.</param>
/// <param name="newTag">The new tag name.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> RenameTag(int itemID, string oldTag, string newTag)
{
return await Send(new ActionParameter()
@@ -146,12 +157,13 @@ namespace PocketSharp
/// <summary>
/// Renames a tag.
/// Renames a tag in an item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="oldTag">The old tag.</param>
/// <param name="newTag">The new tag name.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<bool> RenameTag(PocketItem item, string oldTag, string newTag)
{
return await RenameTag(item.ID, oldTag, newTag);
+11 -4
View File
@@ -12,10 +12,12 @@ namespace PocketSharp
public partial class PocketClient
{
/// <summary>
/// Retrieves all items from pocket
/// Retrieves items from pocket
/// with the given filters
/// </summary>
/// <param name="parameters">parameters, which are mapped to the officials from http://getpocket.com/developer/docs/v3/retrieve </param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<List<PocketItem>> Retrieve(
State? state = null,
bool? favorite = null,
@@ -52,9 +54,11 @@ namespace PocketSharp
/// <summary>
/// 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.
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<PocketItem> Retrieve(int itemID)
{
List<PocketItem> items = await Retrieve(
@@ -66,10 +70,11 @@ namespace PocketSharp
/// <summary>
/// Retrieves all items with a filter from pocket
/// Retrieves all items by a given filter
/// </summary>
/// <param name="filter">The filter.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<List<PocketItem>> RetrieveByFilter(RetrieveFilter filter = RetrieveFilter.All)
{
RetrieveParameters parameters = new RetrieveParameters();
@@ -105,10 +110,11 @@ namespace PocketSharp
/// <summary>
/// Retrieves items by tag from pocket
/// Retrieves items by tag
/// </summary>
/// <param name="tag">The tag.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<List<PocketItem>> SearchByTag(string tag)
{
return await Retrieve(tag: tag);
@@ -116,10 +122,11 @@ namespace PocketSharp
/// <summary>
/// Retrieves items from pocket which match the specified search string in title or content
/// Retrieves items which match the specified search string in title or content
/// </summary>
/// <param name="searchString">The search string.</param>
/// <returns></returns>
/// <exception cref="PocketException"></exception>
public async Task<List<PocketItem>> Search(string searchString)
{
return await Retrieve(search: searchString);