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.Mattermost/IMattermostApi.cs
Normal file
10
src/Ombi.Api.Mattermost/IMattermostApi.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Threading.Tasks;
|
||||
using Ombi.Api.Mattermost.Models;
|
||||
|
||||
namespace Ombi.Api.Mattermost
|
||||
{
|
||||
public interface IMattermostApi
|
||||
{
|
||||
Task<string> PushAsync(string webhook, MattermostBody message);
|
||||
}
|
||||
}
|
27
src/Ombi.Api.Mattermost/MattermostApi.cs
Normal file
27
src/Ombi.Api.Mattermost/MattermostApi.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Api.Mattermost.Models;
|
||||
|
||||
namespace Ombi.Api.Mattermost
|
||||
{
|
||||
public class MattermostApi : IMattermostApi
|
||||
{
|
||||
public MattermostApi(IApi api)
|
||||
{
|
||||
_api = api;
|
||||
}
|
||||
|
||||
private readonly IApi _api;
|
||||
|
||||
public async Task<string> PushAsync(string webhook, MattermostBody message)
|
||||
{
|
||||
var request = new Request(string.Empty, webhook, HttpMethod.Post);
|
||||
|
||||
request.AddJsonBody(message);
|
||||
|
||||
var result = await _api.RequestContent(request);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
45
src/Ombi.Api.Mattermost/Models/MattermostBody.cs
Normal file
45
src/Ombi.Api.Mattermost/Models/MattermostBody.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: MattermostBody.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Ombi.Api.Mattermost.Models
|
||||
{
|
||||
public class MattermostBody
|
||||
{
|
||||
[JsonConstructor]
|
||||
public MattermostBody()
|
||||
{
|
||||
username = "Ombi";
|
||||
}
|
||||
|
||||
public string username { get; set; } = "Ombi";
|
||||
public string channel { get; set; }
|
||||
public string text { get; set; }
|
||||
public string icon_url { get; set; }
|
||||
}
|
||||
}
|
15
src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj
Normal file
15
src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj
Normal file
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard1.6</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ombi.Api\Ombi.Api.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue