public async Task <PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string)) { var request = new RestRequest { Method = Method.POST, }; request.AddHeader("Access-Token", accessToken); request.AddHeader("Content-Type", "application/json"); var push = new PushbulletPush { title = title, body = message, type = "note" }; if (!string.IsNullOrEmpty(deviceIdentifier)) { push.device_iden = deviceIdentifier; } request.AddJsonBody(push); var api = new ApiRequest(); return(await Task.Run(() => api.ExecuteJson <PushbulletResponse>(request, new Uri("https://api.pushbullet.com/v2/pushes")))); }
public async Task <PushoverResponse> PushAsync(string accessToken, string message, string userToken) { var request = new RestRequest { Method = Method.POST, Resource = "messages.json?token={token}&user={user}&message={message}" }; request.AddUrlSegment("token", accessToken); request.AddUrlSegment("message", message); request.AddUrlSegment("user", userToken); var api = new ApiRequest(); return(await Task.Run(() => api.ExecuteJson <PushoverResponse>(request, new Uri("https://api.pushover.net/1")))); }