Skip to content

Commit

Permalink
msgraph GetEventsBetweenDates
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartingr committed Jul 25, 2023
1 parent 8e117eb commit 429698a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
12 changes: 10 additions & 2 deletions server/remote/msgraph/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ func (c *client) TentativelyAcceptEvent(remoteUserID, eventID string) error {
return nil
}

func (c *client) GetEventsBetweenDates(_ string, start, end time.Time) ([]*remote.Event, error) {
return nil, errors.New("not implemented")
func (c *client) GetEventsBetweenDates(remoteUserID string, start, end time.Time) ([]*remote.Event, error) {
paramStr := getQueryParamStringForCalendarView(start, end)
res := &calendarViewResponse{}
err := c.rbuilder.Users().ID(remoteUserID).CalendarView().Request().JSONRequest(
c.ctx, http.MethodGet, paramStr, nil, res)
if err != nil {
return nil, errors.Wrap(err, "msgraph GetEventsBetweenDates")
}

return res.Value, nil
}
11 changes: 1 addition & 10 deletions server/remote/msgraph/get_default_calendar_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,7 @@ type calendarViewBatchResponse struct {
}

func (c *client) GetDefaultCalendarView(remoteUserID string, start, end time.Time) ([]*remote.Event, error) {
paramStr := getQueryParamStringForCalendarView(start, end)

res := &calendarViewResponse{}
err := c.rbuilder.Users().ID(remoteUserID).CalendarView().Request().JSONRequest(
c.ctx, http.MethodGet, paramStr, nil, res)
if err != nil {
return nil, errors.Wrap(err, "msgraph GetDefaultCalendarView")
}

return res.Value, nil
return c.GetEventsBetweenDates(remoteUserID, start, end)
}

func (c *client) DoBatchViewCalendarRequests(allParams []*remote.ViewCalendarParams) ([]*remote.ViewCalendarResponse, error) {
Expand Down

0 comments on commit 429698a

Please sign in to comment.