added simple documentation where it was forgotten...

This commit is contained in:
2013-06-27 00:53:30 +02:00
parent d51410de06
commit cb69aa13d0
18 changed files with 567 additions and 7 deletions
+2 -1
View File
@@ -124,7 +124,7 @@ namespace PocketSharp
/// <summary>
/// Renames a tag.
/// </summary>
/// <param name="item">The item.<param>
/// <param name="item">The item.</param>
/// <param name="oldTag">The old tag.</param>
/// <param name="newTag">The new tag name.</param>
/// <returns></returns>
@@ -139,6 +139,7 @@ namespace PocketSharp
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <param name="action">The action.</param>
/// <param name="tags">The tags.</param>
/// <returns></returns>
protected bool PutSendActionForTags(int itemID, string action, string[] tags)
{
+22 -1
View File
@@ -75,7 +75,7 @@ namespace PocketSharp
/// <summary>
/// Retrieves items from pocket which match the specified search string in title or content
/// </summary>
/// <param name="tag">The tag.</param>
/// <param name="searchString">The search string.</param>
/// <returns></returns>
public List<PocketItem> Search(string searchString)
{
@@ -94,12 +94,33 @@ namespace PocketSharp
/// </summary>
public enum RetrieveFilter
{
/// <summary>
/// All types
/// </summary>
All,
/// <summary>
/// Only unread items
/// </summary>
Unread,
/// <summary>
/// Archived items
/// </summary>
Archive,
/// <summary>
/// Favorited items
/// </summary>
Favorite,
/// <summary>
/// Only articles
/// </summary>
Article,
/// <summary>
/// Only videos
/// </summary>
Video,
/// <summary>
/// Only images
/// </summary>
Image
}
}
@@ -4,12 +4,27 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models.Authentification
{
/// <summary>
/// Access Code
/// </summary>
[DataContract]
public class AccessCode
internal class AccessCode
{
/// <summary>
/// Gets or sets the code.
/// </summary>
/// <value>
/// The code.
/// </value>
[DataMember(Name = "access_token")]
public string Code { get; set; }
/// <summary>
/// Gets or sets the username.
/// </summary>
/// <value>
/// The username.
/// </value>
[DataMember]
public string Username { get; set; }
}
@@ -4,12 +4,27 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models.Authentification
{
/// <summary>
/// Request Code
/// </summary>
[DataContract]
class RequestCode
internal class RequestCode
{
/// <summary>
/// Gets or sets the code.
/// </summary>
/// <value>
/// The code.
/// </value>
[DataMember]
public string Code { get; set; }
/// <summary>
/// Gets or sets the state.
/// </summary>
/// <value>
/// The state.
/// </value>
[DataMember]
public string State { get; set; }
}
@@ -6,23 +6,66 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// All parameters which can be passed for a modify action
/// </summary>
public class ActionParameter
{
/// <summary>
/// Gets or sets the action.
/// </summary>
/// <value>
/// The action.
/// </value>
public string Action { get; set; }
/// <summary>
/// Gets or sets the ID.
/// </summary>
/// <value>
/// The ID.
/// </value>
public int ID { get; set; }
/// <summary>
/// Gets or sets the time.
/// </summary>
/// <value>
/// The time.
/// </value>
public DateTime? Time { get; set; }
// specific params
/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>
/// The tags.
/// </value>
public string[] Tags { get; set; }
/// <summary>
/// Gets or sets the old tag.
/// </summary>
/// <value>
/// The old tag.
/// </value>
public string OldTag { get; set; }
/// <summary>
/// Gets or sets the new tag.
/// </summary>
/// <value>
/// The new tag.
/// </value>
public string NewTag { get; set; }
/// <summary>
/// Converts this instance to a parameter list.
/// </summary>
/// <returns></returns>
public object Convert()
{
Dictionary<string, object> parameters = new Dictionary<string, object>
@@ -6,16 +6,47 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// All parameters which can be passed to add a new item
/// </summary>
public class AddParameters
{
/// <summary>
/// Gets or sets the URI.
/// </summary>
/// <value>
/// The URI.
/// </value>
public Uri Uri { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>
/// The tags.
/// </value>
public string[] Tags { get; set; }
/// <summary>
/// Gets or sets the tweet ID.
/// </summary>
/// <value>
/// The tweet ID.
/// </value>
public string TweetID { get; set; }
/// <summary>
/// Converts this instance to a parameter list.
/// </summary>
/// <returns></returns>
public List<Parameter> Convert()
{
return new List<Parameter>()
@@ -5,11 +5,24 @@ using System.Collections.Generic;
namespace PocketSharp.Models
{
/// <summary>
/// All parameters which can be passed to modify an item
/// </summary>
public class ModifyParameters
{
/// <summary>
/// Gets or sets the actions.
/// </summary>
/// <value>
/// The actions.
/// </value>
public List<ActionParameter> Actions { get; set; }
/// <summary>
/// Converts this instance to a parameter list.
/// </summary>
/// <returns></returns>
public List<Parameter> Convert()
{
List<object> actions = new List<object>();
@@ -7,31 +7,104 @@ using ServiceStack.Text;
namespace PocketSharp.Models
{
/// <summary>
/// All parameters which can be passed for item retrieval
/// </summary>
public class RetrieveParameters
{
/// <summary>
/// Gets or sets the state.
/// </summary>
/// <value>
/// The state.
/// </value>
public StateEnum? State { get; set; }
/// <summary>
/// Gets or sets the favorite.
/// </summary>
/// <value>
/// The favorite.
/// </value>
public bool? Favorite { get; set; }
/// <summary>
/// Gets or sets the tag.
/// </summary>
/// <value>
/// The tag.
/// </value>
public string Tag { get; set; }
/// <summary>
/// Gets or sets the type of the content.
/// </summary>
/// <value>
/// The type of the content.
/// </value>
public ContentTypeEnum? ContentType { get; set; }
/// <summary>
/// Gets or sets the sort.
/// </summary>
/// <value>
/// The sort.
/// </value>
public SortEnum? Sort { get; set; }
/// <summary>
/// Gets or sets the type of the detail.
/// </summary>
/// <value>
/// The type of the detail.
/// </value>
public DetailTypeEnum? DetailType { get; set; }
/// <summary>
/// Gets or sets the search.
/// </summary>
/// <value>
/// The search.
/// </value>
public string Search { get; set; }
/// <summary>
/// Gets or sets the domain.
/// </summary>
/// <value>
/// The domain.
/// </value>
public string Domain { get; set; }
/// <summary>
/// Gets or sets the since.
/// </summary>
/// <value>
/// The since.
/// </value>
public DateTime? Since { get; set; }
/// <summary>
/// Gets or sets the count.
/// </summary>
/// <value>
/// The count.
/// </value>
public int? Count { get; set; }
/// <summary>
/// Gets or sets the offset.
/// </summary>
/// <value>
/// The offset.
/// </value>
public int? Offset { get; set; }
/// <summary>
/// Converts this instance to a parameter list.
/// </summary>
/// <returns></returns>
public List<Parameter> Convert()
{
return new List<Parameter>()
@@ -52,31 +125,79 @@ namespace PocketSharp.Models
}
/// <summary>
/// Item states
/// </summary>
public enum StateEnum
{
/// <summary>
/// Only unread items
/// </summary>
unread,
/// <summary>
/// Only archived items
/// </summary>
archive,
/// <summary>
/// All items
/// </summary>
all
}
/// <summary>
/// Sorting
/// </summary>
public enum SortEnum
{
/// <summary>
/// Newest first
/// </summary>
newest,
/// <summary>
/// Oldest first
/// </summary>
oldest,
/// <summary>
/// Title A-Z descending
/// </summary>
title,
/// <summary>
/// URL descending
/// </summary>
site
}
/// <summary>
/// Item types
/// </summary>
public enum ContentTypeEnum
{
/// <summary>
/// Articles
/// </summary>
article,
/// <summary>
/// Videos
/// </summary>
video,
/// <summary>
/// Images
/// </summary>
image
}
/// <summary>
/// Item data
/// </summary>
public enum DetailTypeEnum
{
/// <summary>
/// Necessary data
/// </summary>
simple,
/// <summary>
/// Includes all Images/videos/tags/authors
/// </summary>
complete
}
}
+21
View File
@@ -3,15 +3,36 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// Author
/// </summary>
[DataContract]
public class PocketAuthor
{
/// <summary>
/// Gets or sets the ID.
/// </summary>
/// <value>
/// The ID.
/// </value>
[DataMember(Name = "author_id")]
public string ID { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>
/// The name.
/// </value>
[DataMember]
public string Name { get; set; }
/// <summary>
/// Gets or sets the URI.
/// </summary>
/// <value>
/// The URI.
/// </value>
[DataMember(Name = "url")]
public Uri Uri { get; set; }
}
+27
View File
@@ -3,18 +3,45 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// Image
/// </summary>
[DataContract]
public class PocketImage
{
/// <summary>
/// Gets or sets the ID.
/// </summary>
/// <value>
/// The ID.
/// </value>
[DataMember(Name = "image_id")]
public string ID { get; set; }
/// <summary>
/// Gets or sets the caption.
/// </summary>
/// <value>
/// The caption.
/// </value>
[DataMember]
public string Caption { get; set; }
/// <summary>
/// Gets or sets the credit.
/// </summary>
/// <value>
/// The credit.
/// </value>
[DataMember]
public string Credit { get; set; }
/// <summary>
/// Gets or sets the URI.
/// </summary>
/// <value>
/// The URI.
/// </value>
[DataMember(Name = "src")]
public Uri Uri { get; set; }
}
+166
View File
@@ -4,102 +4,268 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// Item containing all available data
/// see: http://getpocket.com/developer/docs/v3/retrieve
/// </summary>
[DataContract]
public class PocketItem
{
/// <summary>
/// Gets or sets the ID.
/// </summary>
/// <value>
/// The ID.
/// </value>
[DataMember(Name = "item_id")]
public int ID { get; set; }
/// <summary>
/// Gets or sets the URI.
/// </summary>
/// <value>
/// The URI.
/// </value>
[DataMember(Name = "resolved_url")]
public Uri Uri { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
[DataMember(Name = "resolved_title")]
public string Title { get; set; }
/// <summary>
/// Gets or sets the full title.
/// </summary>
/// <value>
/// The full title.
/// </value>
[DataMember(Name = "given_title")]
public string FullTitle { get; set; }
/// <summary>
/// Gets or sets the excerpt.
/// </summary>
/// <value>
/// The excerpt.
/// </value>
[DataMember]
public string Excerpt { get; set; }
/// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>
/// The status.
/// </value>
[DataMember]
public int Status { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is favorite.
/// </summary>
/// <value>
/// <c>true</c> if this instance is favorite; otherwise, <c>false</c>.
/// </value>
[DataMember(Name = "favorite")]
public bool IsFavorite { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is archive.
/// </summary>
/// <value>
/// <c>true</c> if this instance is archive; otherwise, <c>false</c>.
/// </value>
[IgnoreDataMember]
public bool IsArchive { get { return Status == 1; } }
/// <summary>
/// Gets a value indicating whether this instance is deleted.
/// </summary>
/// <value>
/// <c>true</c> if this instance is deleted; otherwise, <c>false</c>.
/// </value>
[IgnoreDataMember]
public bool IsDeleted { get { return Status == 2; } }
/// <summary>
/// Gets or sets a value indicating whether this instance is article.
/// </summary>
/// <value>
/// <c>true</c> if this instance is article; otherwise, <c>false</c>.
/// </value>
[DataMember(Name = "is_article")]
public bool IsArticle { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has image.
/// </summary>
/// <value>
/// <c>true</c> if this instance has image; otherwise, <c>false</c>.
/// </value>
[DataMember(Name = "has_image")]
public bool HasImage { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has video.
/// </summary>
/// <value>
/// <c>true</c> if this instance has video; otherwise, <c>false</c>.
/// </value>
[DataMember(Name = "has_video")]
public bool HasVideo { get; set; }
/// <summary>
/// Gets or sets the word count.
/// </summary>
/// <value>
/// The word count.
/// </value>
[DataMember(Name = "word_count")]
public int WordCount { get; set; }
/// <summary>
/// Gets or sets the sort.
/// </summary>
/// <value>
/// The sort.
/// </value>
[DataMember(Name = "sort_id")]
public int Sort { get; set; }
/// <summary>
/// Gets or sets the add time.
/// </summary>
/// <value>
/// The add time.
/// </value>
[DataMember(Name = "time_added")]
public DateTime? AddTime { get; set; }
/// <summary>
/// Gets or sets the update time.
/// </summary>
/// <value>
/// The update time.
/// </value>
[DataMember(Name = "time_updated")]
public DateTime? UpdateTime { get; set; }
/// <summary>
/// Gets or sets the read time.
/// </summary>
/// <value>
/// The read time.
/// </value>
[DataMember(Name = "time_read")]
public DateTime? ReadTime { get; set; }
/// <summary>
/// Gets or sets the favorite time.
/// </summary>
/// <value>
/// The favorite time.
/// </value>
[DataMember(Name = "time_favorited")]
public DateTime? FavoriteTime { get; set; }
/// <summary>
/// Gets or sets the _ tag dictionary.
/// </summary>
/// <value>
/// The _ tag dictionary.
/// </value>
[DataMember(Name = "tags")]
public Dictionary<string, PocketTag> _TagDictionary { get; set; }
/// <summary>
/// Gets or sets the _ image dictionary.
/// </summary>
/// <value>
/// The _ image dictionary.
/// </value>
[DataMember(Name = "images")]
public Dictionary<string, PocketImage> _ImageDictionary { get; set; }
/// <summary>
/// Gets or sets the _ video dictionary.
/// </summary>
/// <value>
/// The _ video dictionary.
/// </value>
[DataMember(Name = "videos")]
public Dictionary<string, PocketVideo> _VideoDictionary { get; set; }
/// <summary>
/// Gets or sets the _ author dictionary.
/// </summary>
/// <value>
/// The _ author dictionary.
/// </value>
[DataMember(Name = "authors")]
public Dictionary<string, PocketAuthor> _AuthorDictionary { get; set; }
/// <summary>
/// Gets the tags.
/// </summary>
/// <value>
/// The tags.
/// </value>
[IgnoreDataMember]
public List<PocketTag> Tags
{
get { return Utilities.DictionaryToList<PocketTag>(_TagDictionary); }
}
/// <summary>
/// Gets the images.
/// </summary>
/// <value>
/// The images.
/// </value>
[IgnoreDataMember]
public List<PocketImage> Images
{
get { return Utilities.DictionaryToList<PocketImage>(_ImageDictionary); }
}
/// <summary>
/// Gets the lead image.
/// </summary>
/// <value>
/// The lead image.
/// </value>
[IgnoreDataMember]
public PocketImage LeadImage
{
get { return Images != null ? Images[0] : null; }
}
/// <summary>
/// Gets the videos.
/// </summary>
/// <value>
/// The videos.
/// </value>
[IgnoreDataMember]
public List<PocketVideo> Videos
{
get { return Utilities.DictionaryToList<PocketVideo>(_VideoDictionary); }
}
/// <summary>
/// Gets the authors.
/// </summary>
/// <value>
/// The authors.
/// </value>
[IgnoreDataMember]
public List<PocketAuthor> Authors
{
+9
View File
@@ -2,9 +2,18 @@
namespace PocketSharp.Models
{
/// <summary>
/// Tag
/// </summary>
[DataContract]
public class PocketTag
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>
/// The name.
/// </value>
[DataMember(Name = "tag")]
public string Name { get; set; }
}
+21
View File
@@ -3,15 +3,36 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// Video
/// </summary>
[DataContract]
public class PocketVideo
{
/// <summary>
/// Gets or sets the ID.
/// </summary>
/// <value>
/// The ID.
/// </value>
[DataMember(Name = "video_id")]
public string ID { get; set; }
/// <summary>
/// Gets or sets the external ID.
/// </summary>
/// <value>
/// The external ID.
/// </value>
[DataMember(Name = "vid")]
public string ExternalID { get; set; }
/// <summary>
/// Gets or sets the URI.
/// </summary>
/// <value>
/// The URI.
/// </value>
[DataMember(Name = "src")]
public Uri Uri { get; set; }
}
+9
View File
@@ -4,9 +4,18 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// Add Response
/// </summary>
[DataContract]
class Add : ResponseBase
{
/// <summary>
/// Gets or sets the item.
/// </summary>
/// <value>
/// The item.
/// </value>
[DataMember]
public PocketItem Item { get; set; }
}
+9
View File
@@ -4,9 +4,18 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// Modify Response
/// </summary>
[DataContract]
class Modify : ResponseBase
{
/// <summary>
/// Gets or sets the action results.
/// </summary>
/// <value>
/// The action results.
/// </value>
[DataMember(Name = "action_results")]
public bool[] ActionResults { get; set; }
}
@@ -6,9 +6,18 @@ using System.Text;
namespace PocketSharp.Models
{
/// <summary>
/// Base for Responses
/// </summary>
[DataContract]
class ResponseBase
{
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ResponseBase"/> is status.
/// </summary>
/// <value>
/// <c>true</c> if status is OK; otherwise, <c>false</c>.
/// </value>
[DataMember(Name = "status")]
public bool Status { get; set; }
}
+27
View File
@@ -4,18 +4,45 @@ using System.Runtime.Serialization;
namespace PocketSharp.Models
{
/// <summary>
/// Item Response
/// </summary>
[DataContract]
class Retrieve : ResponseBase
{
/// <summary>
/// Gets or sets the complete.
/// </summary>
/// <value>
/// The complete.
/// </value>
[DataMember(Name = "complete")]
public int Complete { get; set; }
/// <summary>
/// Gets or sets the since.
/// </summary>
/// <value>
/// The since.
/// </value>
[DataMember]
public int Since { get; set; }
/// <summary>
/// Gets or sets the _ item dictionary.
/// </summary>
/// <value>
/// The _ item dictionary.
/// </value>
[DataMember(Name = "list")]
public Dictionary<string, PocketItem> _ItemDictionary { get; set; }
/// <summary>
/// Gets the items.
/// </summary>
/// <value>
/// The items.
/// </value>
[IgnoreDataMember]
public List<PocketItem> Items
{
+5 -3
View File
@@ -63,17 +63,19 @@ namespace PocketSharp
/// <summary>
/// Initializes a new instance of the <see cref="PocketClient"/> class.
/// Initializes a new instance of the <see cref="PocketClient" /> class.
/// </summary>
/// <param name="consumerKey">The API key.</param>
/// <param name="accessCode">The access code.</param>
public PocketClient(string consumerKey, string accessCode)
: this(consumerKey, accessCode, defaultBaseUrl) { }
/// <summary>
/// Initializes a new instance of the <see cref="PocketClient"/> class.
/// Initializes a new instance of the <see cref="PocketClient" /> class.
/// </summary>
/// <param name="consumerKey">The API key.</param>
/// <param name="baseUrl">The base URL.</param>
public PocketClient(string consumerKey, Uri baseUrl)
: this(consumerKey, "", baseUrl) { }
@@ -83,6 +85,7 @@ namespace PocketSharp
/// </summary>
/// <param name="consumerKey">The API key.</param>
/// <param name="accessCode">Provide an access code if the user is already authenticated</param>
/// <param name="baseUrl">The base URL.</param>
public PocketClient(string consumerKey, string accessCode, Uri baseUrl)
{
// assign public properties
@@ -192,7 +195,6 @@ namespace PocketSharp
/// <summary>
/// Puts an action
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <param name="actionParameter">The action parameter.</param>
/// <returns></returns>
protected bool PutSendAction(ActionParameter actionParameter)