entries endpoint
This commit is contained in:
@@ -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<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);
|
||||
return entries != null && entries.Any() ? entries[0] : null;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,18 +23,5 @@ namespace FeedlySharp
|
||||
ids = ids.Select(id => id.StartsWith("feed/") ? id : "feed/" + id).ToArray();
|
||||
return await Client.Request<List<FeedlyFeed>>(HttpMethod.Post, "v3/feeds/.mget", ids, true, true, cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
//public async Task<bool> 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;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,17 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Endpoints\Entries.cs" />
|
||||
<Compile Include="Endpoints\Feeds.cs" />
|
||||
<Compile Include="Endpoints\Subscriptions.cs" />
|
||||
<Compile Include="Endpoints\Topics.cs" />
|
||||
<Compile Include="Models\FeedlyEntry.cs" />
|
||||
<Compile Include="Models\FeedlyFeed.cs" />
|
||||
<Compile Include="Models\FeedlyImage.cs" />
|
||||
<Compile Include="Models\FeedlyLink.cs" />
|
||||
<Compile Include="Models\FeedlyOrigin.cs" />
|
||||
<Compile Include="Models\FeedlySubscription.cs" />
|
||||
<Compile Include="Models\FeedlyText.cs" />
|
||||
<Compile Include="Models\FeedlyTopic.cs" />
|
||||
<Compile Include="Endpoints\OPML.cs" />
|
||||
<Compile Include="Extensions\JsonExtensions.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<FeedlyTag> Tags { get; set; }
|
||||
|
||||
public int Engagement { get; set; }
|
||||
|
||||
[JsonProperty("alternate")]
|
||||
public List<FeedlyLink> AlternateLinks { get; set; }
|
||||
|
||||
[JsonProperty("canonical")]
|
||||
public List<FeedlyLink> CanonicalLinks { get; set; }
|
||||
|
||||
public FeedlyText Summary { get; set; }
|
||||
|
||||
public FeedlyText Content { get; set; }
|
||||
|
||||
public FeedlyOrigin Origin { get; set; }
|
||||
|
||||
public List<FeedlyCategory> Categories { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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."); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user