From 421134f975d5f2d0b0779055faf1be80df150439 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Wed, 26 Nov 2014 21:37:24 +0100 Subject: [PATCH] docs for auth + categories --- FeedlySharp/Endpoints/Auth.cs | 42 ++++++++++++++++++++++++++--- FeedlySharp/Endpoints/Categories.cs | 27 ++++++++++++++++--- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/FeedlySharp/Endpoints/Auth.cs b/FeedlySharp/Endpoints/Auth.cs index 4337a40..b3e3962 100644 --- a/FeedlySharp/Endpoints/Auth.cs +++ b/FeedlySharp/Endpoints/Auth.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; -using System.Text; using System.Threading.Tasks; using FeedlySharp.Extensions; using FeedlySharp.Models; @@ -13,6 +11,13 @@ namespace FeedlySharp { public partial class FeedlyClient { + /// + /// Creates the authentication URI to redirect the user to. + /// + /// auth-endpoint (https://developer.feedly.com/v3/auth/#authenticating-a-user-and-obtaining-a-code) + /// The scope. + /// The state which is passed and returned when finished. + /// public string GetAuthenticationUri(string scope = "subscriptions", string state = default(String)) { return String.Format("{0}/v3/auth/auth?redirect_uri={1}&client_id={2}&scope={3}&state={4}&response_type=code", @@ -24,13 +29,21 @@ namespace FeedlySharp ); } - + /// + /// Parses the authentication response URI and creates the response object. + /// + /// The URI where the user has been redirected to after authentication. + /// public AuthenticationResponse ParseAuthenticationResponseUri(string uri) { return ParseAuthenticationResponseUri(new Uri(uri, UriKind.Absolute)); } - + /// + /// Parses the authentication response URI and creates the response object. + /// + /// The URI where the user has been redirected to after authentication. + /// public AuthenticationResponse ParseAuthenticationResponseUri(Uri uri) { Dictionary queryParams = uri.ParseQueryString(); @@ -46,6 +59,13 @@ namespace FeedlySharp } + /// + /// Request to get the access token. + /// + /// auth-endpoint (https://developer.feedly.com/v3/auth/#exchanging-a-code-for-a-refresh-token-and-an-access-token) + /// The authentication code. + /// The cancellation token. + /// public async Task RequestAccessToken(string authenticationCode, CancellationToken cancellationToken = default(CancellationToken)) { return await Client.Request(HttpMethod.Post, "v3/auth/token", new Dictionary() @@ -59,6 +79,13 @@ namespace FeedlySharp } + /// + /// Request to get a new refresh token and update authentication. + /// + /// auth-endpoint (https://developer.feedly.com/v3/auth/#using-a-refresh-token) + /// The current refresh token. + /// The cancellation token. + /// public async Task RequestRefreshToken(string refreshToken, CancellationToken cancellationToken = default(CancellationToken)) { return await Client.Request(HttpMethod.Post, "v3/auth/token", new Dictionary() @@ -71,6 +98,13 @@ namespace FeedlySharp } + /// + /// Revokes the current refresh token and logs out. + /// + /// auth-endpoint (https://developer.feedly.com/v3/auth/#revoking-a-refresh-token) + /// The refresh token. + /// The cancellation token. + /// public async Task RevokeRefreshToken(string refreshToken, CancellationToken cancellationToken = default(CancellationToken)) { await Client.Request(HttpMethod.Post, "v3/auth/token", new Dictionary() diff --git a/FeedlySharp/Endpoints/Categories.cs b/FeedlySharp/Endpoints/Categories.cs index f213898..59a2f2e 100644 --- a/FeedlySharp/Endpoints/Categories.cs +++ b/FeedlySharp/Endpoints/Categories.cs @@ -1,7 +1,6 @@ using FeedlySharp.Models; using System; using System.Collections.Generic; -using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; @@ -10,18 +9,40 @@ namespace FeedlySharp { public partial class FeedlyClient { + /// + /// Returns all categories created by the user. + /// Authentication required. + /// + /// categories-endpoint (https://developer.feedly.com/v3/categories/#get-the-list-of-all-categories) + /// The cancellation token. + /// public async Task> GetCategories(CancellationToken cancellationToken = default(CancellationToken)) { return await Client.Request>(HttpMethod.Get, "v3/categories", null, false, true, cancellationToken); } - + /// + /// Renames a user category. + /// Authentication required. + /// + /// categories-endpoint (https://developer.feedly.com/v3/categories/#change-the-label-of-an-existing-category) + /// The category id. + /// The new label. + /// The cancellation token. + /// public async Task RenameCategory(string id, string label, CancellationToken cancellationToken = default(CancellationToken)) { await Client.Request(HttpMethod.Post, String.Format("v3/categories/{0}", ValueToResource("category", id)), new { label = label }, true, true, cancellationToken); } - + /// + /// Deletes a user category. + /// Authentication required. + /// + /// categories-endpoint (https://developer.feedly.com/v3/categories/#delete-a-category) + /// The category id. + /// The cancellation token. + /// public async Task DeleteCategory(string id, CancellationToken cancellationToken = default(CancellationToken)) { await Client.Request(HttpMethod.Delete, String.Format("v3/categories/{0}", ValueToResource("category", id)), null, false, true, cancellationToken);