forked from mattermost/mattermost-plugin-mscalendar
/
client.go
58 lines (49 loc) · 1.87 KB
/
client.go
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
// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved.
// See License for license information.
package remote
import (
"net/url"
"time"
)
type Client interface {
Core
Calendars
Events
Subscriptions
Utils
Unsupported
}
type Core interface {
GetMe() (*User, error)
}
type Calendars interface {
GetEvent(remoteUserID, eventID string) (*Event, error)
GetCalendars(remoteUserID string) ([]*Calendar, error)
GetDefaultCalendarView(remoteUserID string, startTime, endTime time.Time) ([]*Event, error)
DoBatchViewCalendarRequests([]*ViewCalendarParams) ([]*ViewCalendarResponse, error)
GetMailboxSettings(remoteUserID string) (*MailboxSettings, error)
}
type Events interface {
CreateEvent(remoteUserID string, calendarEvent *Event) (*Event, error)
AcceptEvent(remoteUserID, eventID string) error
DeclineEvent(remoteUserID, eventID string) error
TentativelyAcceptEvent(remoteUserID, eventID string) error
GetEventsBetweenDates(remoteUserID string, start, end time.Time) ([]*Event, error)
}
type Subscriptions interface {
CreateMySubscription(notificationURL, remoteUserID string) (*Subscription, error)
DeleteSubscription(sub *Subscription) error
GetNotificationData(*Notification) (*Notification, error)
ListSubscriptions() ([]*Subscription, error)
RenewSubscription(notificationURL, remoteUserID string, sub *Subscription) (*Subscription, error)
}
type Utils interface {
GetSuperuserToken() (string, error)
CallFormPost(method, path string, in url.Values, out interface{}) (responseData []byte, err error)
CallJSON(method, path string, in, out interface{}) (responseData []byte, err error)
}
type Unsupported interface {
CreateCalendar(remoteUserID string, calendar *Calendar) (*Calendar, error)
DeleteCalendar(remoteUserID, calendarID string) error
FindMeetingTimes(remoteUserID string, meetingParams *FindMeetingTimesParameters) (*MeetingTimeSuggestionResults, error)
}