mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-31 03:50:08 -07:00
Add Gotify as notification provider
This commit is contained in:
parent
0517fdd939
commit
94b70c2f2c
23 changed files with 454 additions and 3 deletions
36
src/Ombi.Api.Gotify/GotifyApi.cs
Normal file
36
src/Ombi.Api.Gotify/GotifyApi.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ombi.Api.Gotify
|
||||
{
|
||||
public class GotifyApi : IGotifyApi
|
||||
{
|
||||
public GotifyApi(IApi api)
|
||||
{
|
||||
_api = api;
|
||||
}
|
||||
|
||||
private readonly IApi _api;
|
||||
|
||||
public async Task PushAsync(string baseUrl, string accessToken, string subject, string body, sbyte priority)
|
||||
{
|
||||
var request = new Request("/message", baseUrl, HttpMethod.Post);
|
||||
request.AddQueryString("token", accessToken);
|
||||
|
||||
request.AddHeader("Access-Token", accessToken);
|
||||
request.ApplicationJsonContentType();
|
||||
|
||||
|
||||
var jsonBody = new
|
||||
{
|
||||
message = body,
|
||||
title = subject,
|
||||
priority = priority
|
||||
};
|
||||
|
||||
request.AddJsonBody(jsonBody);
|
||||
|
||||
await _api.Request(request);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue