diff --git a/FeedlySharp/Endpoints/Entries.cs b/FeedlySharp/Endpoints/Entries.cs new file mode 100644 index 0000000..2e4af91 --- /dev/null +++ b/FeedlySharp/Endpoints/Entries.cs @@ -0,0 +1,26 @@ +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 + { + public async Task GetEntry(string id, CancellationToken cancellationToken = default(CancellationToken)) + { + List entries = await Client.Request>(HttpMethod.Get, String.Format("v3/entries/{0}", WebUtility.UrlEncode(id)), null, false, true, cancellationToken); + return entries != null && entries.Any() ? entries[0] : null; + } + + + public async Task> GetEntries(string[] ids, CancellationToken cancellationToken = default(CancellationToken)) + { + return await Client.Request>(HttpMethod.Post, "v3/entries/.mget", ids, true, true, cancellationToken); + } + } +} diff --git a/FeedlySharp/Endpoints/Feeds.cs b/FeedlySharp/Endpoints/Feeds.cs index 597ddba..9872b08 100644 --- a/FeedlySharp/Endpoints/Feeds.cs +++ b/FeedlySharp/Endpoints/Feeds.cs @@ -23,18 +23,5 @@ namespace FeedlySharp ids = ids.Select(id => id.StartsWith("feed/") ? id : "feed/" + id).ToArray(); return await Client.Request>(HttpMethod.Post, "v3/feeds/.mget", ids, true, true, cancellationToken); } - - - //public async Task AddOrUpdateTopic(string topic, 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); - // return true; - //} - } } diff --git a/FeedlySharp/FeedlySharp.csproj b/FeedlySharp/FeedlySharp.csproj index 2f4a838..2303744 100644 --- a/FeedlySharp/FeedlySharp.csproj +++ b/FeedlySharp/FeedlySharp.csproj @@ -34,11 +34,17 @@ 4 + + + + + + diff --git a/FeedlySharp/Models/FeedlyEntry.cs b/FeedlySharp/Models/FeedlyEntry.cs new file mode 100644 index 0000000..7c92cba --- /dev/null +++ b/FeedlySharp/Models/FeedlyEntry.cs @@ -0,0 +1,54 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FeedlySharp.Models +{ + public class FeedlyEntry + { + public string Id { get; set; } + + public string Fingerprint { get; set; } + + public string OriginId { get; set; } + + public string Title { get; set; } + + public string Author { get; set; } + + [JsonProperty("published")] + public DateTime? PublishedDate { get; set; } + + [JsonProperty("crawled")] + public DateTime? CrawledDate { get; set; } + + [JsonProperty("updated")] + public DateTime? UpdateDate { get; set; } + + [JsonProperty("unread")] + public bool IsUnread { get; set; } + + public string[] Keywords { get; set; } + + public List Tags { get; set; } + + public int Engagement { get; set; } + + [JsonProperty("alternate")] + public List AlternateLinks { get; set; } + + [JsonProperty("canonical")] + public List CanonicalLinks { get; set; } + + public FeedlyText Summary { get; set; } + + public FeedlyText Content { get; set; } + + public FeedlyOrigin Origin { get; set; } + + public List Categories { get; set; } + } +} diff --git a/FeedlySharp/Models/FeedlyImage.cs b/FeedlySharp/Models/FeedlyImage.cs new file mode 100644 index 0000000..7096224 --- /dev/null +++ b/FeedlySharp/Models/FeedlyImage.cs @@ -0,0 +1,17 @@ +using Newtonsoft.Json; +using System; + +namespace FeedlySharp.Models +{ + public class FeedlyImage + { + [JsonProperty("url")] + public Uri Uri { get; set; } + + public int? Width { get; set; } + + public int? Height { get; set; } + + public string ContentType { get; set; } + } +} diff --git a/FeedlySharp/Models/FeedlyLink.cs b/FeedlySharp/Models/FeedlyLink.cs new file mode 100644 index 0000000..c49120a --- /dev/null +++ b/FeedlySharp/Models/FeedlyLink.cs @@ -0,0 +1,14 @@ +using Newtonsoft.Json; +using System; + +namespace FeedlySharp.Models +{ + public class FeedlyLink + { + [JsonProperty("href")] + public Uri Uri { get; set; } + + [JsonProperty("type")] + public string ContentType { get; set; } + } +} diff --git a/FeedlySharp/Models/FeedlyOrigin.cs b/FeedlySharp/Models/FeedlyOrigin.cs new file mode 100644 index 0000000..28fceb0 --- /dev/null +++ b/FeedlySharp/Models/FeedlyOrigin.cs @@ -0,0 +1,17 @@ +using Newtonsoft.Json; +using System; + +namespace FeedlySharp.Models +{ + public class FeedlyOrigin + { + [JsonProperty("streamId")] + public string Id { get; set; } + + [JsonProperty("htmlUrl")] + public Uri Uri { get; set; } + + [JsonProperty("title")] + public string Name { get; set; } + } +} diff --git a/FeedlySharp/Models/FeedlyTag.cs b/FeedlySharp/Models/FeedlyTag.cs index e35da9f..6a31a1c 100644 --- a/FeedlySharp/Models/FeedlyTag.cs +++ b/FeedlySharp/Models/FeedlyTag.cs @@ -11,6 +11,6 @@ namespace FeedlySharp.Models public string Label { get; set; } - public bool IsGlobal { get; set; } + public bool IsGlobal { get { return Name.StartsWith("global."); } } } } diff --git a/FeedlySharp/Models/FeedlyText.cs b/FeedlySharp/Models/FeedlyText.cs new file mode 100644 index 0000000..ba6de68 --- /dev/null +++ b/FeedlySharp/Models/FeedlyText.cs @@ -0,0 +1,17 @@ + +namespace FeedlySharp.Models +{ + public class FeedlyText + { + public Direction Direction { get; set; } + + public string Content { get; set; } + } + + public enum Direction + { + Unknown, + Ltr, + Rtl + } +} diff --git a/README.md b/README.md index ed71d55..6805975 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ 6. ✔ Topics endpoint 7. ✔ OPML endpoint 8. Entries endpoint -9. Feeds endpoint +9. ✔ Feeds endpoint 10. Markers endpoint 11. Mixes endpoint 12. Search endpoint