Skip to content

Commit

Permalink
Merge pull request #6 from krichprollsch/extra-params
Browse files Browse the repository at this point in the history
Add extra parameters for Event Api
  • Loading branch information
Taluu committed Sep 15, 2015
2 parents 30ad58d + d78d373 commit 91807b6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Api/EventApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ private function requestEvents($url, array $params = [])
* @param string $filter `$filter` query parameter to give to the request
* @param string $orderBy `$orderBy` query, to have an order of elements
*/
public function getList(Calendar $calendar = null, $filter = '', $orderBy = '')
public function getList(Calendar $calendar = null, $filter = '', $orderBy = '', array $extraParameters = [])
{
$url = 'events';

if (null !== $calendar) {
$url = sprintf('calendars/%s/events', $calendar->getId());
}

$params = [];
$params = $extraParameters;

if (!empty($filter)) {
$params['$filter'] = $filter;
Expand Down Expand Up @@ -115,7 +115,8 @@ public function getCalendarView(
DateTime $from,
DateTime $to,
$filter = '',
$orderBy = ''
$orderBy = '',
array $extraParameters = []
) {
$url = 'calendarview';

Expand All @@ -136,7 +137,7 @@ public function getCalendarView(
$params['$orderBy'] = $orderBy;
}

$params = ['query' => $params];
$params = ['query' => array_merge($params, $extraParameters)];

return $this->requestEvents($url, $params);
}
Expand Down

0 comments on commit 91807b6

Please sign in to comment.