Repository navigation
Expand file tree
/
Copy pathcalendars.go
More file actions
105 lines (94 loc) · 4.06 KB
/
Copy pathcalendars.go
File metadata and controls
105 lines (94 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Code generated by internal/cmd/gen; DO NOT EDIT.
package flashduty
import "context"
// CalendarsService handles the "On-call/Calendars" API resource.
type CalendarsService service
// Delete calendar event.
//
// Delete one event of a personal calendar by event_id, or clear the calendar's own events off the days [start_at, end_at). Pass either event_id or both start_at and end_at. Cleared days fall back to the linked holiday calendars and the weekly workdays.
//
// API: POST /calendar/event/delete (calEventDelete).
func (s *CalendarsService) CalEventDelete(ctx context.Context, req *CalEventIDRequest) (*Response, error) {
return s.client.do(ctx, "/calendar/event/delete", req, nil)
}
// List calendar events.
//
// Return events for a personal calendar within a year/month/day scope. When month and day are both omitted the whole year is returned. The response also carries days, the resolved state of every day in the scope.
//
// API: POST /calendar/event/list (calEventList).
func (s *CalendarsService) CalEventList(ctx context.Context, req *CalEventListRequest) (*CalEventListResponse, *Response, error) {
out := new(CalEventListResponse)
resp, err := s.client.do(ctx, "/calendar/event/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Upsert calendar event.
//
// Create or update an event the calendar owns (a day off or a working-day override) over the days [start_at, end_at). Omit event_id to create a new event; a given event_id must be an existing event of this calendar. The write clears the calendar's other own events off the same days: an event fully inside the range is deleted, one partly inside is shortened, and one spanning the range is split in two, so the latest write decides those days. end_at must be later than start_at.
//
// API: POST /calendar/event/upsert (calEventUpsert).
func (s *CalendarsService) CalEventUpsert(ctx context.Context, req *CalEventUpsertRequest) (*CalEventUpsertResponse, *Response, error) {
out := new(CalEventUpsertResponse)
resp, err := s.client.do(ctx, "/calendar/event/upsert", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Create calendar.
//
// Create a personal service calendar. Each account is limited to 5 calendars unless the Flashcat-Break-Cal-Limit header is set.
//
// API: POST /calendar/create (calendarCreate).
func (s *CalendarsService) CalendarCreate(ctx context.Context, req *CalendarCreateRequest) (*CalendarCreateResponse, *Response, error) {
out := new(CalendarCreateResponse)
resp, err := s.client.do(ctx, "/calendar/create", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Delete calendar.
//
// Delete a personal service calendar. The call fails when referenced by escalation or silence rules.
//
// API: POST /calendar/delete (calendarDelete).
func (s *CalendarsService) CalendarDelete(ctx context.Context, req *CalendarIDRequest) (*Response, error) {
return s.client.do(ctx, "/calendar/delete", req, nil)
}
// Get calendar info.
//
// Return details of a service calendar.
//
// API: POST /calendar/info (calendarInfo).
func (s *CalendarsService) CalendarInfo(ctx context.Context, req *CalendarIDRequest) (*CalendarItem, *Response, error) {
out := new(CalendarItem)
resp, err := s.client.do(ctx, "/calendar/info", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// List calendars.
//
// Return the list of service calendars visible to the current account.
//
// API: POST /calendar/list (calendarList).
func (s *CalendarsService) CalendarList(ctx context.Context, req *CalendarListRequest) (*CalendarListResponse, *Response, error) {
out := new(CalendarListResponse)
resp, err := s.client.do(ctx, "/calendar/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Update calendar.
//
// Update a personal service calendar. Only non-null fields are updated.
//
// API: POST /calendar/update (calendarUpdate).
func (s *CalendarsService) CalendarUpdate(ctx context.Context, req *CalendarUpdateRequest) (*Response, error) {
return s.client.do(ctx, "/calendar/update", req, nil)
}