finalize docs

This commit is contained in:
2014-11-26 22:56:52 +01:00
parent 4e911eb53c
commit 349f123e9d
8 changed files with 190 additions and 33 deletions
+13 -3
View File
@@ -1,7 +1,5 @@
using FeedlySharp.Models;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
@@ -10,12 +8,24 @@ namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Get the profile of the user.
/// </summary>
/// <remarks>profile-endpoint (https://developer.feedly.com/v3/profile/#get-the-profile-of-the-user)</remarks>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<FeedlyUser> GetProfile(CancellationToken cancellationToken = default(CancellationToken))
{
return await Client.Request<FeedlyUser>(HttpMethod.Get, "v3/profile", null, false, true, cancellationToken);
}
/// <summary>
/// Update the profile of the user.
/// </summary>
/// <remarks>profile-endpoint (https://developer.feedly.com/v3/profile/#update-the-profile-of-the-user)</remarks>
/// <param name="parameters">The update profile parameters, see https://developer.feedly.com/v3/profile/#update-the-profile-of-the-user </param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<FeedlyUser> UpdateProfile(Dictionary<string, string> parameters, CancellationToken cancellationToken = default(CancellationToken))
{
return await Client.Request<FeedlyUser>(HttpMethod.Post, "v3/profile", parameters, true, true, cancellationToken);
+32 -1
View File
@@ -9,6 +9,15 @@ namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Find feeds based on title, url or #topic.
/// </summary>
/// <remarks>search-endpoint (https://developer.feedly.com/v3/search/#find-feeds-based-on-title-url-or-topic)</remarks>
/// <param name="searchQuery">Query can be a feed url, a site title, a site url or a #topic.</param>
/// <param name="count">Number of results. Default value is 20.</param>
/// <param name="locale">Hint the search engine to return feeds in that locale (e.g. “pt”, “fr_FR”).</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<List<FeedlySearchFeed>> FindFeeds(string searchQuery, int? count = null, string locale = null, CancellationToken cancellationToken = default(CancellationToken))
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -26,6 +35,25 @@ namespace FeedlySharp
}
/// <summary>
/// Search the content of a stream.
/// </summary>
/// <remarks>search-endpoint (https://developer.feedly.com/v3/search/#search-the-content-of-a-stream)</remarks>
/// <param name="contentId">
/// A feedId, a categoryId, a tagId or a system category ids.
/// If none is provided, the server will use the “global.all” category.
/// The special topic “topic/global.popular” can also be used to search the most popular 50,000 sources in feedly.
/// </param>
/// <param name="searchQuery">See the http://feedly.uservoice.com/knowledgebase/articles/441699-power-search-tutorial for syntax.</param>
/// <param name="newerThan">Date from where to fetch.</param>
/// <param name="continuation">A continuation id is used to page through the content. Pass the continuation from a search result to get the next set of results for this search. Note: this value is ignored for non-Pro users.</param>
/// <param name="fields">A comma-separated list of fields. By default, all fields are used for matching. Valid field names: all, title, author, keywords. Default is all.</param>
/// <param name="embedded">Audio, video, doc or any limit results to also include this media type. “any” means the article must contain at least one embed. Default behavior is to not filter by embedded.</param>
/// <param name="engagement">Medium or high limit results to articles that have the specified engagement. Default behavior is to not filter by engagement.</param>
/// <param name="count">Number of entries to return. Default is 10. max is 20. Note: if the user isnt pro, only 2 articles will be returned.</param>
/// <param name="locale">Used to filter by locale. Only used in topic/global.popular searches.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<FeedlySearchResponse> FindEntries(
string contentId,
string searchQuery,
@@ -39,7 +67,10 @@ namespace FeedlySharp
CancellationToken cancellationToken = default(CancellationToken))
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["streamId"] = contentId;
if (!String.IsNullOrWhiteSpace(contentId))
{
parameters["streamId"] = contentId;
}
parameters["query"] = searchQuery;
if (newerThan.HasValue)
{
+26
View File
@@ -9,6 +9,19 @@ namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Get a list of entry ids for a specific stream.
/// </summary>
/// <remarks>streams-endpoint (https://developer.feedly.com/v3/streams/#get-a-list-of-entry-ids-for-a-specific-stream)</remarks>
/// <param name="id">A feedId, a categoryId, a tagId or a system category id.</param>
/// <param name="type">The type of the <paramref name="id"/>.</param>
/// <param name="count">Number of entry ids to return. Default is 20, max is 10000.</param>
/// <param name="sorting">Newest or oldest. Default is newest.</param>
/// <param name="unreadOnly">if <c>true</c>, return unread entry ids only.</param>
/// <param name="newerThan">Date from where to search on.</param>
/// <param name="continuation">A continuation id is used to page through the entry ids.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<FeedlyStreamEntryIdsResponse> GetStreamEntryIds(
string id,
ContentType type,
@@ -45,6 +58,19 @@ namespace FeedlySharp
}
/// <summary>
/// Get a list of entries for a specific stream.
/// </summary>
/// <remarks>streams-endpoint (https://developer.feedly.com/v3/streams/#get-the-content-of-a-stream)</remarks>
/// <param name="id">A feedId, a categoryId, a tagId or a system category id.</param>
/// <param name="type">The type of the <paramref name="id"/>.</param>
/// <param name="count">Number of entry ids to return. Default is 20, max is 10000.</param>
/// <param name="sorting">Newest or oldest. Default is newest.</param>
/// <param name="unreadOnly">if <c>true</c>, return unread entries only.</param>
/// <param name="newerThan">Date from where to search on.</param>
/// <param name="continuation">A continuation id is used to page through the entries.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<FeedlyStreamEntriesResponse> GetStreamEntries(
string id,
ContentType type,
+21 -2
View File
@@ -11,12 +11,26 @@ namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Get the users subscriptions.
/// </summary>
/// <remarks>subscriptions-endpoint (https://developer.feedly.com/v3/subscriptions/#get-the-users-subscriptions)</remarks>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<List<FeedlySubscription>> GetSubscriptions(CancellationToken cancellationToken = default(CancellationToken))
{
return await Client.Request<List<FeedlySubscription>>(HttpMethod.Get, "v3/subscriptions", null, false, true, cancellationToken);
}
/// <summary>
/// Adds or updates a subscription.
/// </summary>
/// <remarks>subscriptions-endpoint (https://developer.feedly.com/v3/subscriptions/#subscribe-to-a-feed)</remarks>
/// <param name="id">The id of the subscription/feed.</param>
/// <param name="categories">The categories where the feed to assign to.</param>
/// <param name="optionalTitle">The optional title for the feed.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> AddOrUpdateSubscription(string id, List<FeedlyCategory> categories = null, string optionalTitle = null, CancellationToken cancellationToken = default(CancellationToken))
{
dynamic parameters = new { id = (id.StartsWith("feed/") ? id : "feed/" + id) };
@@ -34,7 +48,12 @@ namespace FeedlySharp
return true;
}
/// <summary>
/// Unsubscribe from a feed.
/// </summary>
/// <param name="id">The id of the subscription/feed.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> RemoveSubscription(string id, CancellationToken cancellationToken = default(CancellationToken))
{
id = id.StartsWith("feed/") ? id : "feed/" + id;
+46 -5
View File
@@ -11,12 +11,25 @@ namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Get the list of tags created by the user.
/// </summary>
/// <remarks>tags-endpoint (https://developer.feedly.com/v3/tags/#get-the-list-of-tags-created-by-the-user)</remarks>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<List<FeedlyTag>> GetTags(CancellationToken cancellationToken = default(CancellationToken))
{
return await Client.Request<List<FeedlyTag>>(HttpMethod.Get, "v3/tags", null, false, true, cancellationToken);
}
/// <summary>
/// Update tags for an existing entry.
/// </summary>
/// <remarks>tags-endpoint (https://developer.feedly.com/v3/tags/#tag-an-existing-entry)</remarks>
/// <param name="entryId">The entry id.</param>
/// <param name="tags">The new tags.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> UpdateTags(string entryId, string[] tags, CancellationToken cancellationToken = default(CancellationToken))
{
string tagsString = String.Join(",", tags.Select(x => ValueToResource("tag", x)));
@@ -24,7 +37,14 @@ namespace FeedlySharp
return true;
}
/// <summary>
/// Update tags for existing entries.
/// </summary>
/// <remarks>tags-endpoint (https://developer.feedly.com/v3/tags/#tag-multiple-entries)</remarks>
/// <param name="entryId">The entry ids.</param>
/// <param name="tags">The new tags.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> UpdateTags(string[] entryIds, string[] tags, CancellationToken cancellationToken = default(CancellationToken))
{
string tagsString = String.Join(",", tags.Select(x => ValueToResource("tag", x)));
@@ -32,14 +52,28 @@ namespace FeedlySharp
return true;
}
/// <summary>
/// Change a tag label.
/// </summary>
/// <remarks>tags-endpoint (https://developer.feedly.com/v3/tags/#change-a-tag-label)</remarks>
/// <param name="oldTag">The old tag label.</param>
/// <param name="newTag">The new tag label.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> RenameTag(string oldTag, string newTag, CancellationToken cancellationToken = default(CancellationToken))
{
await Client.Request<object>(HttpMethod.Post, String.Format("v3/tags/{0}", ValueToResource("tag", oldTag)), new { label = newTag }, true, true, cancellationToken);
return true;
}
/// <summary>
/// Untag multiple entries.
/// </summary>
/// <remarks>tags-endpoint (https://developer.feedly.com/v3/tags/#untag-multiple-entries)</remarks>
/// <param name="entryIds">The entry ids.</param>
/// <param name="tags">The tags to remove from the entries.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> RemoveTags(string[] entryIds, string[] tags, CancellationToken cancellationToken = default(CancellationToken))
{
string tagsString = String.Join(",", tags.Select(x => ValueToResource("tag", x)));
@@ -48,7 +82,14 @@ namespace FeedlySharp
return true;
}
/// <summary>
/// Delete tags.
/// The tags will be removed from all the entries, and from the list of tags. Note: global tags (global.read, global.saved) cannot be passed to this call.
/// </summary>
/// <remarks>tags-endpoint (https://developer.feedly.com/v3/tags/#delete-tags)</remarks>
/// <param name="tags">The tags to delete.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> RemoveTags(string[] tags, CancellationToken cancellationToken = default(CancellationToken))
{
string tagsString = String.Join(",", tags.Select(x => ValueToResource("tag", x)));
+26 -13
View File
@@ -1,42 +1,55 @@
using FeedlySharp.Models;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Linq;
namespace FeedlySharp
{
public partial class FeedlyClient
{
/// <summary>
/// Get the list of topics the user has added to their feedly.
/// </summary>
/// <remarks>topics-endpoint (https://developer.feedly.com/v3/topics/#get-the-list-of-topics-the-user-has-added-to-their-feedly)</remarks>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<List<FeedlyTopic>> GetTopics(CancellationToken cancellationToken = default(CancellationToken))
{
return await Client.Request<List<FeedlyTopic>>(HttpMethod.Get, "v3/topics", null, false, true, cancellationToken);
}
public async Task<bool> AddOrUpdateTopic(string topic, Interest interest = Interest.Low, CancellationToken cancellationToken = default(CancellationToken))
/// <summary>
/// Add or update a topic-
/// </summary>
/// <remarks>topics-endpoint (https://developer.feedly.com/v3/topics/#add-a-topic-to-the-user-feedly-account)</remarks>
/// <param name="topicId">The topic id.</param>
/// <param name="interest">The interest of the topic.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
/// <exception cref="System.ArgumentOutOfRangeException">Select low, medium or high for the interest.</exception>
public async Task<bool> AddOrUpdateTopic(string topicId, Interest interest = Interest.Low, CancellationToken cancellationToken = default(CancellationToken))
{
if (interest == Interest.Unknown)
{
throw new ArgumentOutOfRangeException("Select low, medium or high for the interest.");
}
await Client.Request(HttpMethod.Post, "v3/topics", new { id = ValueToResource("topic", topic, false), interest = interest.ToString().ToLower() }, true, true, cancellationToken);
await Client.Request(HttpMethod.Post, "v3/topics", new { id = ValueToResource("topic", topicId, false), interest = interest.ToString().ToLower() }, true, true, cancellationToken);
return true;
}
public async Task<bool> RemoveTopic(string topic, Interest interest = Interest.Low, CancellationToken cancellationToken = default(CancellationToken))
/// <summary>
/// Remove a topic from a feedly account.
/// </summary>
/// <remarks>topics-endpoint (https://developer.feedly.com/v3/topics/#remove-a-topic-from-a-feedly-account)</remarks>
/// <param name="topic">The topic id.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<bool> RemoveTopic(string topicId, CancellationToken cancellationToken = default(CancellationToken))
{
if (interest == Interest.Unknown)
{
throw new ArgumentOutOfRangeException("Select low, medium or high for the interest.");
}
await Client.Request(HttpMethod.Delete, String.Format("v3/topics/{0}", ValueToResource("topic", topic)), null, false, true, cancellationToken);
await Client.Request(HttpMethod.Delete, String.Format("v3/topics/{0}", ValueToResource("topic", topicId)), null, false, true, cancellationToken);
return true;
}
}
+24 -8
View File
@@ -9,6 +9,9 @@ namespace FeedlySharp
{
public partial class FeedlyClient : IDisposable
{
/// <summary>
/// The environment of feedly.
/// </summary>
public readonly CloudEnvironment Environment;
private readonly string ClientId;
@@ -25,7 +28,14 @@ namespace FeedlySharp
private FeedlyHttpClient Client { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="FeedlyClient"/> class.
/// </summary>
/// <param name="environment">The environment of feedly.</param>
/// <param name="clientId">The client id.</param>
/// <param name="clientSecret">The client secret.</param>
/// <param name="redirectUri">The redirect URI.</param>
/// <exception cref="System.ArgumentNullException">redirectUri;Authentication and token generation requires an URI to redirect to afterwards</exception>
public FeedlyClient(CloudEnvironment environment, string clientId, string clientSecret, string redirectUri)
{
if (String.IsNullOrEmpty(redirectUri))
@@ -40,7 +50,11 @@ namespace FeedlySharp
Client = new FeedlyHttpClient(new Uri(CloudUri, UriKind.Absolute));
}
/// <summary>
/// Activates the client to call methods which need authentication.
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <param name="userId">The user id.</param>
public void Activate(string accessToken, string userId)
{
AccessToken = accessToken;
@@ -48,6 +62,14 @@ namespace FeedlySharp
Client.AccessToken = accessToken;
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Client.Dispose();
}
private string GetCloudUri(CloudEnvironment environment)
{
@@ -73,12 +95,6 @@ namespace FeedlySharp
return ValueToResource(key, value, encode);
}
public void Dispose()
{
Client.Dispose();
}
}
public enum CloudEnvironment
+2 -1
View File
@@ -7,7 +7,8 @@
**This project is work in progress.<br>Status:**
1. ✔ Add implementation for all endpoints
2. Write tests
2. Write inline documentation
2. Unit tests
## Supported platforms