public IncidentViewModel(IncidentImpact impact, string title, List <IncidentUpdateResource> updates)
 {
     Impact  = impact;
     Title   = title;
     Updates = updates;
 }
Ejemplo n.º 2
0
        public async Task <Incident> CreateRealtimeIncident(string pageId, string name, List <string> componentIds = null, string message = null, IncidentStatus status = IncidentStatus.Investigating, bool wantsTwitterUpdate = false, IncidentImpact incidentImpactOverride = IncidentImpact.None)
        {
            var incidentParameters = new Dictionary <string, string>
            {
                { "incident[name]", name },
                { "incident[status]", status.ToString().ToLower() },
                { "incident[wants_twitter_update]", wantsTwitterUpdate ? "t" : "f" },
                { "incident[impact_override]", incidentImpactOverride.ToString().ToLower() }
            };

            if (!string.IsNullOrEmpty(message))
            {
                incidentParameters.Add("incident[message]", message);
            }

            if (componentIds != null)
            {
                foreach (var componentId in componentIds)
                {
                    incidentParameters.Add("incident[component_ids][]", componentId);
                }
            }

            return(await Post <Incident>(string.Format("pages/{0}/incidents.json", pageId), incidentParameters));
        }