mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Refactored the Notification service to how it should have really been done in the first place.
This commit is contained in:
parent
840deb6161
commit
3fe1f13bd1
17 changed files with 220 additions and 166 deletions
|
@ -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")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using Nancy.Helpers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Notifications;
|
||||
|
||||
|
@ -35,7 +36,7 @@ namespace PlexRequests.Api
|
|||
{
|
||||
public class PushoverApi : IPushoverApi
|
||||
{
|
||||
public PushoverResponse Push(string accessToken, string message, string userToken)
|
||||
public async Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
|
@ -49,7 +50,7 @@ namespace PlexRequests.Api
|
|||
|
||||
|
||||
var api = new ApiRequest();
|
||||
return api.ExecuteJson<PushoverResponse>(request, new Uri("https://api.pushover.net/1"));
|
||||
return await Task.Run(() => api.ExecuteJson<PushoverResponse>(request, new Uri("https://api.pushover.net/1")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue