Skip to content

Commit

Permalink
Merge pull request cronofy#107 from cronofy/add-recurrence-hash
Browse files Browse the repository at this point in the history
Add recurrence option to upsertEvent
  • Loading branch information
AdamWhittingham authored May 19, 2021
2 parents 500592c + 42d2e87 commit 27c4ae3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.4.0]
* add support for `recurrence` key on upsertEvent (this is currently pre-release and not generally available yet)

## [1.3.0]
* add AvailablePeriod create, read, delete and bulkDelete [#105] [#106]
* add support for empty descriptions [#103]
Expand Down Expand Up @@ -80,7 +83,8 @@
[1.1.9]: https://github.com/cronofy/cronofy-php/releases/tag/v1.1.9
[1.1.10]: https://github.com/cronofy/cronofy-php/releases/tag/v1.1.10
[1.2.0]: https://github.com/cronofy/cronofy-php/releases/tag/v1.2.0
[1.2.0]: https://github.com/cronofy/cronofy-php/releases/tag/v1.3.0
[1.3.0]: https://github.com/cronofy/cronofy-php/releases/tag/v1.3.0
[1.4.0]: https://github.com/cronofy/cronofy-php/releases/tag/v1.4.0

[#32]: https://github.com/cronofy/cronofy-php/pull/76
[#33]: https://github.com/cronofy/cronofy-php/pull/74
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cronofy/cronofy",
"description": "PHP wrapper for Cronofy's unified calendar API",
"version": "v1.3.0",
"version": "v1.4.0",
"require": {
"php": "^7.1"
},
Expand Down
19 changes: 18 additions & 1 deletion dev-smoke-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

$testEventId = 'php-smoke-test-001';
$testEventData = [
'calendar_id' => 'calendarID',
'calendar_id' => $calendarId,
'event_id' => $testEventId,
'summary' => 'PHP SDK test event 001',
'description' => 'Just checking this thing is on!',
Expand Down Expand Up @@ -100,3 +100,20 @@
foreach($periods->each() as $available_period){
print_r($available_period);
}

echo "\n";
echo "Creating event with recurrence\n";

$recurrenceEventParams = $testEventData;
$recurrenceEventParams['recurrence'] = [
"rules" => [
[
"frequency" => "daily",
"interval" => 2,
"count" => 3,
],
],
];

$cronofy->upsertEvent($recurrenceEventParams);

3 changes: 3 additions & 0 deletions src/Cronofy.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ private function baseUpsertEvent($postFields, $params)
if (!empty($params['subscriptions'])) {
$postFields['subscriptions'] = $params['subscriptions'];
}
if (!empty($params['recurrence'])) {
$postFields['recurrence'] = $params['recurrence'];
}

return $this->httpPost("/" . self::API_VERSION . "/calendars/" . $params['calendar_id'] . "/events", $postFields);
}
Expand Down

0 comments on commit 27c4ae3

Please sign in to comment.