docs for entries + feeds + markers

This commit is contained in:
2014-11-26 21:54:49 +01:00
parent 421134f975
commit 32e49fa82b
3 changed files with 130 additions and 9 deletions
+16 -2
View File
@@ -11,16 +11,30 @@ namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Gets the content of an entry.
/// </summary>
/// <remarks>entries-endpoint (https://developer.feedly.com/v3/entries/#get-the-content-of-an-entry)</remarks>
/// <param name="id">The entry id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<FeedlyEntry> GetEntry(string id, CancellationToken cancellationToken = default(CancellationToken))
{
List<FeedlyEntry> entries = await Client.Request<List<FeedlyEntry>>(HttpMethod.Get, String.Format("v3/entries/{0}", WebUtility.UrlEncode(id)), null, false, true, cancellationToken);
List<FeedlyEntry> entries = await Client.Request<List<FeedlyEntry>>(HttpMethod.Get, String.Format("v3/entries/{0}", WebUtility.UrlEncode(id)), null, false, false, cancellationToken);
return entries != null && entries.Any() ? entries[0] : null;
}
/// <summary>
/// Gets the content of multiple entries.
/// </summary>
/// <remarks>entries-endpoint (https://developer.feedly.com/v3/entries/#get-the-content-for-a-dynamic-list-of-entries)</remarks>
/// <param name="ids">The ids of the entries.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<List<FeedlyEntry>> GetEntries(string[] ids, CancellationToken cancellationToken = default(CancellationToken))
{
return await Client.Request<List<FeedlyEntry>>(HttpMethod.Post, "v3/entries/.mget", ids, true, true, cancellationToken);
return await Client.Request<List<FeedlyEntry>>(HttpMethod.Post, "v3/entries/.mget", ids, true, false, cancellationToken);
}
}
}
+14
View File
@@ -11,6 +11,13 @@ namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Get the metadata about a specific feed.
/// </summary>
/// <remarks>feeds-endpoint (https://developer.feedly.com/v3/feeds/#get-the-metadata-about-a-specific-feed)</remarks>
/// <param name="id">The id of a the feed.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<FeedlyFeed> GetFeed(string id, CancellationToken cancellationToken = default(CancellationToken))
{
id = id.StartsWith("feed/") ? id : "feed/" + id;
@@ -18,6 +25,13 @@ namespace FeedlySharp
}
/// <summary>
/// Get the metadata for a list of feeds.
/// </summary>
/// <remarks>feeds-endpoint (https://developer.feedly.com/v3/feeds/#get-the-metadata-for-a-list-of-feeds)</remarks>
/// <param name="ids">The ids of the feeds.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<List<FeedlyFeed>> GetFeeds(string[] ids, CancellationToken cancellationToken = default(CancellationToken))
{
ids = ids.Select(id => id.StartsWith("feed/") ? id : "feed/" + id).ToArray();
+100 -7
View File
@@ -12,6 +12,15 @@ namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Get the list of unread counts.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#get-the-list-of-unread-counts)</remarks>
/// <param name="isAutoRefresh">Lets the server know if this is a background auto-refresh or not. In case of very high load on the service, the server can deny access to background requests and give priority to user facing operations.</param>
/// <param name="newerThan">Date used as a lower time limit, instead of the default 30 days</param>
/// <param name="categoryId">A user or system category can be passed to restrict the unread count response to feeds in this category.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<List<FeedlyCategoryUnreadCount>> GetMarkersUnreadCount(bool isAutoRefresh = false, DateTime? newerThan = null, string categoryId = null, CancellationToken cancellationToken = default(CancellationToken))
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -32,43 +41,88 @@ namespace FeedlySharp
return (await Client.Request<CategoryUnreadCountResponse>(HttpMethod.Get, "v3/markers/counts", parameters, false, true, cancellationToken)).List;
}
/// <summary>
/// Marks multiple entries as read.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-read)</remarks>
/// <param name="entryIds">The entry ids.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkEntriesAsRead(string[] entryIds, CancellationToken cancellationToken = default(CancellationToken))
{
await Client.Request(HttpMethod.Post, "v3/markers", new { action = "markAsRead", entryIds = entryIds, type = "entries" }, true, true, cancellationToken);
return true;
}
/// <summary>
/// Marks an entry as read.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-read)</remarks>
/// <param name="entryId">The entry id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkEntryAsRead(string entryId, CancellationToken cancellationToken = default(CancellationToken))
{
return await MarkEntriesAsRead(new string[] { entryId }, cancellationToken);
}
/// <summary>
/// Keep multiple entries as unread.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#keep-one-or-multiple-articles-as-unread)</remarks>
/// <param name="entryIds">The entry ids.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> KeepEntriesAsUnread(string[] entryIds, CancellationToken cancellationToken = default(CancellationToken))
{
await Client.Request(HttpMethod.Post, "v3/markers", new { action = "keepUnread", entryIds = entryIds, type = "entries" }, true, true, cancellationToken);
return true;
}
/// <summary>
/// Keep an entry as unread.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#keep-one-or-multiple-articles-as-unread)</remarks>
/// <param name="entryId">The entry id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> KeepEntryAsUnread(string entryId, CancellationToken cancellationToken = default(CancellationToken))
{
return await KeepEntriesAsUnread(new string[] { entryId }, cancellationToken);
}
/// <summary>
/// Mark multiple feeds as read.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-a-feed-as-read)</remarks>
/// <param name="feedIds">The feed ids.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkFeedsAsRead(string[] feedIds, CancellationToken cancellationToken = default(CancellationToken))
{
await Client.Request(HttpMethod.Post, "v3/markers", new { action = "markAsRead", feedIds = feedIds, type = "feeds" }, true, true, cancellationToken);
return true;
}
/// <summary>
/// Mark a feed as read.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-a-feed-as-read)</remarks>
/// <param name="feedId">The feed id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkFeedAsRead(string feedId, CancellationToken cancellationToken = default(CancellationToken))
{
return await MarkFeedsAsRead(new string[] { feedId }, cancellationToken);
}
/// <summary>
/// Mark multiple categories as read.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-a-category-as-read)</remarks>
/// <param name="categoryIds">The category ids.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkCategoriesAsRead(string[] categoryIds, CancellationToken cancellationToken = default(CancellationToken))
{
categoryIds = categoryIds.Select(x => ValueToResource("category", x, false)).ToArray();
@@ -76,36 +130,75 @@ namespace FeedlySharp
return true;
}
/// <summary>
/// Mark a category as read.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-a-category-as-read)</remarks>
/// <param name="categoryId">The category id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkCategoryAsRead(string categoryId, CancellationToken cancellationToken = default(CancellationToken))
{
return await MarkCategoriesAsRead(new string[] { categoryId }, cancellationToken);
}
/// <summary>
/// Marks multiple entries as saved.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-saved)</remarks>
/// <param name="entryIds">The entry ids.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkEntriesAsSaved(string[] entryIds, CancellationToken cancellationToken = default(CancellationToken))
{
await Client.Request(HttpMethod.Post, "v3/markers", new { action = "markAsSaved", categoryIds = entryIds, type = "entries" }, true, true, cancellationToken);
return true;
}
/// <summary>
/// Marks an entriy as saved.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-saved)</remarks>
/// <param name="entryId">The entry id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkEntryAsSaved(string entryId, CancellationToken cancellationToken = default(CancellationToken))
{
return await MarkEntriesAsSaved(new string[] { entryId }, cancellationToken);
}
/// <summary>
/// Marks multiple entries as unsaved.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-unsaved)</remarks>
/// <param name="entryIds">The entry ids.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkEntriesAsUnsaved(string[] entryIds, CancellationToken cancellationToken = default(CancellationToken))
{
await Client.Request(HttpMethod.Post, "v3/markers", new { action = "markAsUnsaved", categoryIds = entryIds, type = "entries" }, true, true, cancellationToken);
return true;
}
/// <summary>
/// Marks an entry as unsaved.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-unsaved)</remarks>
/// <param name="entryId">The entry id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> MarkEntryAsUnsaved(string entryId, CancellationToken cancellationToken = default(CancellationToken))
{
return await MarkEntriesAsUnsaved(new string[] { entryId }, cancellationToken);
}
/// <summary>
/// Get the latest read operations.
/// </summary>
/// <remarks>markers-endpoint (https://developer.feedly.com/v3/markers/#get-the-latest-read-operations-to-sync-local-cache)</remarks>
/// <param name="newerThan">Date from where to fetch the data. Default is 30 days.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<FeedlyReadOperations> GetMarkersReadOperations(DateTime newerThan, CancellationToken cancellationToken = default(CancellationToken))
{
return await Client.Request<FeedlyReadOperations>(HttpMethod.Get, "v3/markers/reads", new Dictionary<string, string>()