Example #1
0
        public Task <List <PagerDutyScheduleOverride> > GetOverridesAsync(PagerDutySchedule shedule)
        {
            string since = DateTime.UtcNow.AddDays(-1).ToString("s"),
                   until = DateTime.UtcNow.AddDays(1).ToString("s");

            return(GetFromPagerDutyAsync("schedules/" + shedule.Id + "/overrides?since=" + since + "&until=" + until, getFromJson:
                                         response => JSON.Deserialize <PagerDutyScheduleOverrideResponse>(response, JilOptions).Overrides));
        }
Example #2
0
        public async Task <string> SetOverrideAsync(PagerDutySchedule shedule, DateTime start, DateTime end, PagerDutyPerson pdPerson)
        {
            var overrideData = new
            {
                @override = new
                {
                    start,
                    end,
                    user = new
                    {
                        id   = pdPerson.Id,
                        type = "user_reference"
                    }
                }
            };
            var result = await GetFromPagerDutyAsync("schedules/" + shedule.Id + "/overrides",
                                                     getFromJson : response => response, httpMethod : "POST", data : overrideData);

            await OnCallInfo.PollAsync(true);

            await PrimaryScheduleOverrides.PollAsync(true);

            return(result);
        }