private async Task <List <NotificationTrigger> > GetNotificationTriggersInternalAsync(Either <IPrtgObject, int> objectOrId, CancellationToken token) { var xmlResponse = await ObjectEngine.GetObjectsXmlAsync(new NotificationTriggerParameters(objectOrId), token : token).ConfigureAwait(false); var typed = ResponseParser.ParseNotificationTriggerResponse(objectOrId, xmlResponse); if (!IsEnglish) { var helper = new NotificationTriggerTranslator(typed, objectOrId.GetId()); NotificationTriggerDataTrigger[] raw = null; int parentId; while (helper.TranslateTriggers(raw, out parentId)) { raw = (await GetNotificationTriggerDataAsync(parentId, token).ConfigureAwait(false)).Triggers; } } var updateTriggerChannels = UpdateTriggerChannelsAsync(objectOrId, typed, token); var updateTriggerActions = UpdateTriggerActionsAsync(typed, token); await Task.WhenAll(updateTriggerChannels, updateTriggerActions).ConfigureAwait(false); return(typed); }
private List <NotificationTrigger> GetNotificationTriggersInternal(Either <IPrtgObject, int> objectOrId, CancellationToken token) { var xmlResponse = ObjectEngine.GetObjectsXml(new NotificationTriggerParameters(objectOrId), token: token); var typed = ResponseParser.ParseNotificationTriggerResponse(objectOrId, xmlResponse); if (!IsEnglish) { var helper = new NotificationTriggerTranslator(typed, objectOrId.GetId()); NotificationTriggerDataTrigger[] raw = null; int parentId; while (helper.TranslateTriggers(raw, out parentId)) { raw = GetNotificationTriggerData(parentId, token).Triggers; } } UpdateTriggerChannels(objectOrId, typed, token); UpdateTriggerActions(typed, token); return(typed); }