func (c *Client) DeleteSchedule(id string) error {
	_, err := c.delete("/schedules/" + id)
	return err
}
DeleteSchedule deletes an on-call schedule.
package pagerduty
import (
	"fmt"
	"net/http"
	"github.com/google/go-querystring/query"
)
type Restriction struct {
	Type            string `json:"type,omitempty"`
	StartTimeOfDay  string `json:"start_time_of_day,omitempty"`
	StartDayOfWeek  uint   `json:"start_day_of_week,omitempty"`
	DurationSeconds uint   `json:"duration_seconds,omitempty"`
}
type RenderedScheduleEntry struct {
	Start string    `json:"start,omitempty"`
	End   string    `json:"end,omitempty"`
	User  APIObject `json:"user,omitempty"`
}
type ScheduleLayer struct {
	APIObject
	Name                       string                  `json:"name,omitempty"`
	Start                      string                  `json:"start,omitempty"`
	End                        string                  `json:"end,omitempty"`
	RotationVirtualStart       string                  `json:"rotation_virtual_start,omitempty"`
	RotationTurnLengthSeconds  uint                    `json:"rotation_turn_length_seconds,omitempty"`
	Users                      []UserReference         `json:"users,omitempty"`
	Restrictions               []Restriction           `json:"restrictions,omitempty"`
	RenderedScheduleEntries    []RenderedScheduleEntry `json:"rendered_schedule_entries,omitempty"`
	RenderedCoveragePercentage float64                 `json:"rendered_coverage_percentage,omitempty"`
}
type Schedule struct {
	APIObject
	Name                string          `json:"name,omitempty"`
	TimeZone            string          `json:"time_zone,omitempty"`
	Description         string          `json:"description,omitempty"`
	EscalationPolicies  []APIObject     `json:"escalation_policies,omitempty"`
	Users               []APIObject     `json:"users,omitempty"`
	ScheduleLayers      []ScheduleLayer `json:"schedule_layers,omitempty"`
	OverrideSubschedule ScheduleLayer   `json:"override_subschedule,omitempty"`
	FinalSchedule       ScheduleLayer   `json:"final_schedule,omitempty"`
}
type ListSchedulesOptions struct {
	APIListObject
	Query string `url:"query,omitempty"`
}
type ListSchedulesResponse struct {
	APIListObject
	Schedules []Schedule
}
type UserReference struct {
	User APIObject `json:"user"`
}
func (c *Client) ListSchedules(o ListSchedulesOptions) (*ListSchedulesResponse, error) {
	v, err := query.Values(o)
	if err != nil {
		return nil, err
	}
	resp, err := c.get("/schedules?" + v.Encode())
	if err != nil {
		return nil, err
	}
	var result ListSchedulesResponse
	return &result, c.decodeJSON(resp, &result)
}
func (c *Client) CreateSchedule(s Schedule) (*Schedule, error) {
	data := make(map[string]Schedule)
	data["schedule"] = s
	resp, err := c.post("/schedules", data)
	if err != nil {
		return nil, err
	}
	return getScheduleFromResponse(c, resp)
}
type PreviewScheduleOptions struct {
	APIListObject
	Since    string `url:"since,omitempty"`
	Until    string `url:"until,omitempty"`
	Overflow bool   `url:"overflow,omitempty"`
}
func (c *Client) PreviewSchedule(s Schedule, o PreviewScheduleOptions) error {
	v, err := query.Values(o)
	if err != nil {
		return err
	}
	var data map[string]Schedule
	data["schedule"] = s
	_, e := c.post("/schedules/preview?"+v.Encode(), data)
	return e
}