You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi.Api.Pushbullet/PushbulletApi.cs

37 lines
927 B

using System.Net.Http;
using System.Threading.Tasks;
namespace Ombi.Api.Pushbullet
{
public class PushbulletApi : IPushbulletApi
{
public PushbulletApi(IApi api)
{
Api = api;
}
private IApi Api { get; }
private const string BaseUrl = "https://api.pushbullet.com/v2";
public async Task Push(string accessToken, string subject, string body, string channelTag)
{
var request = new Request("/pushes", BaseUrl, HttpMethod.Post);
request.AddHeader("Access-Token", accessToken);
request.ApplicationJsonContentType();
var jsonBody = new
{
type = "note",
body = body,
title = subject,
channel_tag = channelTag
};
request.AddJsonBody(jsonBody);
await Api.Request(request);
}
}
}