mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Fixed some issues around the tv requests area
Added mattermost and telegram notifications #1459 #865 #1457
This commit is contained in:
parent
03e9852330
commit
bf043fc76e
48 changed files with 1164 additions and 192 deletions
10
src/Ombi.Api.Pushover/IPushoverApi.cs
Normal file
10
src/Ombi.Api.Pushover/IPushoverApi.cs
Normal 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);
|
||||
}
|
||||
}
|
12
src/Ombi.Api.Pushover/Models/PushoverResponse.cs
Normal file
12
src/Ombi.Api.Pushover/Models/PushoverResponse.cs
Normal 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; }
|
||||
}
|
||||
}
|
11
src/Ombi.Api.Pushover/Ombi.Api.Pushover.csproj
Normal file
11
src/Ombi.Api.Pushover/Ombi.Api.Pushover.csproj
Normal 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>
|
26
src/Ombi.Api.Pushover/PushoverApi.cs
Normal file
26
src/Ombi.Api.Pushover/PushoverApi.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue