Refactored the Notification service to how it should have really been done in the first place.

This commit is contained in:
tidusjar 2016-03-24 17:14:45 +00:00
parent 840deb6161
commit 3fe1f13bd1
17 changed files with 220 additions and 166 deletions

View file

@ -25,6 +25,7 @@
// ************************************************************************/
#endregion
using System;
using System.Threading.Tasks;
using PlexRequests.Api.Interfaces;
using PlexRequests.Api.Models.Notifications;
@ -35,7 +36,7 @@ namespace PlexRequests.Api
{
public class PushbulletApi : IPushbulletApi
{
public PushbulletResponse Push(string accessToken, string title, string message, string deviceIdentifier = default(string))
public async Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string))
{
var request = new RestRequest
{
@ -56,7 +57,7 @@ namespace PlexRequests.Api
request.AddJsonBody(push);
var api = new ApiRequest();
return api.ExecuteJson<PushbulletResponse>(request, new Uri("https://api.pushbullet.com/v2/pushes"));
return await Task.Run(() => api.ExecuteJson<PushbulletResponse>(request, new Uri("https://api.pushbullet.com/v2/pushes")));
}
}
}