feeds endpoint

This commit is contained in:
2014-11-20 19:01:57 +01:00
parent 673c714f1f
commit 17b22d9ec1
4 changed files with 97 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
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<FeedlyFeed> GetFeed(string id, CancellationToken cancellationToken = default(CancellationToken))
{
id = id.StartsWith("feed/") ? id : "feed/" + id;
return await Client.Request<FeedlyFeed>(HttpMethod.Get, String.Format("v3/feeds/{0}", WebUtility.UrlEncode(id)), null, false, true, cancellationToken);
}
public async Task<List<FeedlyFeed>> GetFeeds(string[] ids, CancellationToken cancellationToken = default(CancellationToken))
{
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;
//}
}
}
+2
View File
@@ -34,8 +34,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Endpoints\Feeds.cs" />
<Compile Include="Endpoints\Subscriptions.cs" />
<Compile Include="Endpoints\Topics.cs" />
<Compile Include="Models\FeedlyFeed.cs" />
<Compile Include="Models\FeedlySubscription.cs" />
<Compile Include="Models\FeedlyTopic.cs" />
<Compile Include="Endpoints\OPML.cs" />
+51
View File
@@ -0,0 +1,51 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FeedlySharp.Models
{
public class FeedlyFeed
{
public string Id { get; set; }
[JsonProperty("title")]
public string Name { get; set; }
[JsonProperty("visualUrl")]
public Uri Image { get; set; }
public string CoverColor { get; set; }
[JsonProperty("coverUrl")]
public Uri CoverImage { get; set; }
[JsonProperty("iconUrl")]
public Uri IconImage { get; set; }
[JsonProperty("website")]
public Uri Uri { get; set; }
public string[] Topics { get; set; }
public string Language { get; set; }
public string Description { get; set; }
public int? Subscribers { get; set; }
public double? Velocity { get; set; }
[JsonProperty("facebookUsername")]
public string FacebookName { get; set; }
public int? FacebookLikes { get; set; }
[JsonProperty("twitterScreenName")]
public string TwitterName { get; set; }
public int? TwitterFollowers { get; set; }
}
}
+4
View File
@@ -32,6 +32,10 @@ namespace FeedlySharp.Models
public string[] Topics { get; set; }
public string Language { get; set; }
public string Description { get; set; }
public int? Subscribers { get; set; }
public double? Velocity { get; set; }