private void PrintPushOutcome(string pnsType, NotificationDetails details, NotificationOutcomeCollection collection) { if (collection != null) { _logger.LogInformation($"{pnsType} outcome: " + string.Join(",", collection.Select(kv => $"{kv.Key}:{kv.Value}"))); } else { _logger.LogInformation($"{pnsType} no outcomes."); } _logger.LogInformation($"{pnsType} error details URL: {details.PnsErrorDetailsUri}"); }
private async Task GetPushDetailsAndPrintOutcome( string pnsType, NotificationHubClient nhClient, NotificationOutcome notificationOutcome) { // The Notification ID is only available for Standard SKUs. For Basic and Free SKUs the API to get notification outcome details can not be called. if (string.IsNullOrEmpty(notificationOutcome.NotificationId)) { PrintPushNoOutcome(pnsType); return; } var details = await WaitForThePushStatusAsync(pnsType, nhClient, notificationOutcome); NotificationOutcomeCollection collection = null; switch (pnsType) { case "FCM": case "FCM Silent": case "FCM Tags": case "FCM Direct": collection = details.FcmOutcomeCounts; break; case "APNS": case "APNS Silent": case "APNS Tags": case "APNS Direct": collection = details.ApnsOutcomeCounts; break; case "WNS": collection = details.WnsOutcomeCounts; break; default: _logger.LogInformation("Invalid Sendtype"); break; } PrintPushOutcome(pnsType, details, collection); }
private static void PrintPushOutcome(string pnsType, NotificationDetails details, NotificationOutcomeCollection collection) { if (collection != null) { Console.WriteLine($"{pnsType} outcome: " + string.Join(",", collection.Select(kv => $"{kv.Key}:{kv.Value}"))); } else { Console.WriteLine($"{pnsType} no outcomes."); } Console.WriteLine($"{pnsType} error details URL: {details.PnsErrorDetailsUri}"); }