1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

hub api notifications

This commit is contained in:
Kyle Spearrin
2018-08-16 12:05:01 -04:00
parent ff01ce5ca7
commit 28e6783a00
22 changed files with 320 additions and 179 deletions

View File

@ -143,7 +143,7 @@ namespace Bit.Core.Services
ExcludeCurrentContext(request);
}
await SendAsync(request);
await SendAsync(HttpMethod.Post, "/push/send", request);
}
private async Task SendPayloadToOrganizationAsync(Guid orgId, PushType type, object payload, bool excludeCurrentContext)
@ -160,31 +160,7 @@ namespace Bit.Core.Services
ExcludeCurrentContext(request);
}
await SendAsync(request);
}
private async Task SendAsync(PushSendRequestModel requestModel)
{
var tokenStateResponse = await HandleTokenStateAsync();
if(!tokenStateResponse)
{
return;
}
var message = new TokenHttpRequestMessage(requestModel, AccessToken)
{
Method = HttpMethod.Post,
RequestUri = new Uri(string.Concat(Client.BaseAddress, "/push/send"))
};
try
{
await Client.SendAsync(message);
}
catch(Exception e)
{
_logger.LogError(12334, e, "Unable to send push notification.");
}
await SendAsync(HttpMethod.Post, "/push/send", request);
}
private void ExcludeCurrentContext(PushSendRequestModel request)