mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
36 lines
888 B
C#
36 lines
888 B
C#
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);
|
|
}
|
|
}
|
|
}
|