loyalties a must

This commit is contained in:
Tommy Parnell
2017-10-07 12:12:01 -04:00
parent 59e3357be8
commit dc886ed2e7
7 changed files with 76 additions and 2 deletions

View File

@@ -191,8 +191,10 @@ namespace StreamElements.Net
} }
return this.AuthClient.UpdateChatStatsSettings(statsistics); return this.AuthClient.UpdateChatStatsSettings(statsistics);
} }
public Task<LoyaltyResult> GetLoyalty()
{
return this.AuthClient.GetLoyalties();
}
public override T BuildHttpClient<T>(string pathSegment = null) public override T BuildHttpClient<T>(string pathSegment = null)
{ {
var builder = new UriBuilder("https://api.streamelements.com/kappa/v1"); var builder = new UriBuilder("https://api.streamelements.com/kappa/v1");

View File

@@ -0,0 +1,7 @@
namespace StreamElements.Net.Models
{
public class Loyalties
{
}
}

View File

@@ -0,0 +1,39 @@
using Newtonsoft.Json;
namespace StreamElements.Net.Models
{
public class Bonuses
{
[JsonProperty("cheer")]
public int Cheer { get; set; }
[JsonProperty("subscriber")]
public int Subscriber { get; set; }
[JsonProperty("tip")]
public int Tip { get; set; }
[JsonProperty("follow")]
public int Follow { get; set; }
}
public class Loyalty
{
[JsonProperty("bonuses")]
public Bonuses Bonuses { get; set; }
[JsonProperty("subscriberMultiplier")]
public int SubscriberMultiplier { get; set; }
[JsonProperty("amount")]
public int Amount { get; set; }
[JsonProperty("enabled")]
public bool Enabled { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
namespace StreamElements.Net.Models.Results
{
public class LoyaltyResult : Loyalty, IStreamElementsResult
{
public DateTime UpdatedAt { get; set; }
public DateTime CreatedAt { get; set; }
public string User { get; set; }
public string Username { get; set; }
}
}

View File

@@ -37,5 +37,8 @@ namespace StreamElements.Net.Rest
[Put("/chatstats")] [Put("/chatstats")]
Task<ChatStatsSettingsResult> UpdateChatStatsSettings(ChatStatistics stats); Task<ChatStatsSettingsResult> UpdateChatStatsSettings(ChatStatistics stats);
[Get("/loyalties")]
Task<StreamElements.Net.Models.Results.LoyaltyResult> GetLoyalties();
} }
} }

View File

@@ -11,5 +11,8 @@ namespace StreamElements.Net.Rest
[Get("/chatstats/stats/{channel}")] [Get("/chatstats/stats/{channel}")]
Task<Models.ChatStats> GetChatStats(string channel); Task<Models.ChatStats> GetChatStats(string channel);
[Get("/loyalties/{channel}")]
Task<StreamElements.Net.Models.Results.LoyaltyResult> GetLoyalties(string channel);
} }
} }

View File

@@ -32,6 +32,14 @@ namespace StreamElements.Net
} }
return Client.GetChatStats(channel); return Client.GetChatStats(channel);
} }
public Task<Models.Results.LoyaltyResult> GetLoyalty(string channel)
{
if(string.IsNullOrWhiteSpace(nameof(channel)))
{
throw new ArgumentNullException(nameof(channel));
}
return this.Client.GetLoyalties(channel);
}
public virtual T BuildHttpClient<T>(string pathSegment = null) public virtual T BuildHttpClient<T>(string pathSegment = null)
{ {
var builder = new UriBuilder("https://api.streamelements.com/kappa/v1"); var builder = new UriBuilder("https://api.streamelements.com/kappa/v1");