Fixed some issues around the tv requests area

Added mattermost and telegram notifications #1459 #865 #1457
This commit is contained in:
tidusjar 2017-08-21 17:06:07 +01:00
commit bf043fc76e
48 changed files with 1164 additions and 192 deletions

View file

@ -0,0 +1,10 @@
using System.Threading.Tasks;
using Ombi.Api.Pushover.Models;
namespace Ombi.Api.Pushover
{
public interface IPushoverApi
{
Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken);
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Ombi.Api.Pushover.Models
{
public class PushoverResponse
{
public int status { get; set; }
public string request { get; set; }
}
}

View file

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Ombi.Api\Ombi.Api.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,26 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Ombi.Api.Pushover.Models;
namespace Ombi.Api.Pushover
{
public class PushoverApi : IPushoverApi
{
public PushoverApi(IApi api)
{
_api = api;
}
private readonly IApi _api;
private const string PushoverEndpoint = "https://api.pushover.net/1";
public async Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken)
{
var request = new Request($"messages.json?token={accessToken}&user={userToken}&message={message}", PushoverEndpoint, HttpMethod.Post);
var result = await _api.Request<PushoverResponse>(request);
return result;
}
}
}