From 7edc82d7260e52e96776fd94dd8b8cbcede4a765 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Mon, 2 Jul 2018 16:25:09 +0200 Subject: [PATCH] complete new requests for trending --- PocketSharp/Components/Trending.cs | 17 +++++++++++++---- PocketSharp/IPocketClient.cs | 24 ++++++++++++++++++++++-- PocketSharp/Models/PocketItem.cs | 11 ++++++++++- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/PocketSharp/Components/Trending.cs b/PocketSharp/Components/Trending.cs index 027a619..0514b19 100644 --- a/PocketSharp/Components/Trending.cs +++ b/PocketSharp/Components/Trending.cs @@ -11,13 +11,18 @@ namespace PocketSharp public partial class PocketClient { /// - /// Statistics from the user account. + /// Get trending articles on Pocket. + /// Requires an active GUID from GetGuid() and will therefore make two HTTP requests. /// + /// Article count. + /// Two-letter language code for language-specific results. /// The cancellation token. /// /// - public async Task> GetTrendingArticles(string guid, string languageCode = "en", int count = 20, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetTrendingArticles(int count = 20, string languageCode = "en", CancellationToken cancellationToken = default(CancellationToken)) { + string guid = await GetGuid(cancellationToken); + return (await Request("getGlobalRecs", cancellationToken, new Dictionary() { { "guid", guid }, @@ -29,13 +34,17 @@ namespace PocketSharp /// - /// Statistics from the user account. + /// Get trending topics on Pocket. + /// Requires an active GUID from GetGuid() and will therefore make two HTTP requests. /// + /// Two-letter language code for language-specific results. /// The cancellation token. /// /// - public async Task> GetTrendingTopics(string guid, string languageCode = "en", CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetTrendingTopics(string languageCode = "en", CancellationToken cancellationToken = default(CancellationToken)) { + string guid = await GetGuid(cancellationToken); + return (await Request("getTrendingTopics", cancellationToken, new Dictionary() { { "guid", guid }, diff --git a/PocketSharp/IPocketClient.cs b/PocketSharp/IPocketClient.cs index 1aeec0a..c693bcd 100644 --- a/PocketSharp/IPocketClient.cs +++ b/PocketSharp/IPocketClient.cs @@ -465,9 +465,29 @@ namespace PocketSharp Task GetUsageLimits(CancellationToken cancellationToken = default(CancellationToken)); #endregion - Task> GetTrendingArticles(string guid, string languageCode = "en", int count = 20, CancellationToken cancellationToken = default(CancellationToken)); + #region trending methods + /// + /// Get trending articles on Pocket. + /// Requires an active GUID from GetGuid() and will therefore make two HTTP requests. + /// + /// Article count. + /// Two-letter language code for language-specific results. + /// The cancellation token. + /// + /// + Task> GetTrendingArticles(int count = 20, string languageCode = "en", CancellationToken cancellationToken = default(CancellationToken)); - Task> GetTrendingTopics(string guid, string languageCode = "en", CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Get trending topics on Pocket. + /// Requires an active GUID from GetGuid() and will therefore make two HTTP requests. + /// + /// Two-letter language code for language-specific results. + /// The cancellation token. + /// + /// + Task> GetTrendingTopics(string languageCode = "en", CancellationToken cancellationToken = default(CancellationToken)); + #endregion /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. diff --git a/PocketSharp/Models/PocketItem.cs b/PocketSharp/Models/PocketItem.cs index ecfc6da..f204c7f 100644 --- a/PocketSharp/Models/PocketItem.cs +++ b/PocketSharp/Models/PocketItem.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Diagnostics; @@ -299,6 +299,15 @@ namespace PocketSharp.Models [JsonProperty("time_favorited")] public DateTime? FavoriteTime { get; set; } + /// + /// Gets or sets the published time. + /// + /// + /// The time when the article was published. + /// + [JsonProperty("date_published")] + public DateTime? PublishedTime { get; set; } + /// /// Gets or sets the tags as comma-separated strings. ///