diff --git a/CHANGELOG.md b/CHANGELOG.md
index 088f7c0..0d8a3b6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+## [1.12.8]
+* Add support for extended_transparency for events. [#142]
+
## [1.12.7]
* Add support for Availability Rules endpoints. [#139]
@@ -341,6 +344,7 @@
[1.12.5]: https://github.com/cronofy/cronofy-csharp/releases/tag/rel-1.12.5
[1.12.6]: https://github.com/cronofy/cronofy-csharp/releases/tag/rel-1.12.6
[1.12.7]: https://github.com/cronofy/cronofy-csharp/releases/tag/rel-1.12.7
+[1.12.8]: https://github.com/cronofy/cronofy-csharp/releases/tag/rel-1.12.8
[#3]: https://github.com/cronofy/cronofy-csharp/pull/3
[#10]: https://github.com/cronofy/cronofy-csharp/pull/10
@@ -416,3 +420,4 @@
[#135]: https://github.com/cronofy/cronofy-csharp/pull/135
[#137]: https://github.com/cronofy/cronofy-csharp/pull/137
[#139]: https://github.com/cronofy/cronofy-csharp/pull/139
+[#142]: https://github.com/cronofy/cronofy-csharp/pull/142
diff --git a/VERSION b/VERSION
index 41c8a73..f61e315 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.12.7
+1.12.8
diff --git a/src/Cronofy/Event.cs b/src/Cronofy/Event.cs
index f253bc4..bc4abaa 100644
--- a/src/Cronofy/Event.cs
+++ b/src/Cronofy/Event.cs
@@ -115,6 +115,17 @@ public sealed class Event
///
public string Transparency { get; set; }
+ ///
+ /// Gets or sets the extended transparency of the event.
+ ///
+ ///
+ /// The extended transparency of the event.
+ ///
+ ///
+ /// See for potential values.
+ ///
+ public string ExtendedTransparency { get; set; }
+
///
/// Gets or sets the status of the event.
///
@@ -261,6 +272,7 @@ public bool Equals(Event other)
&& this.Description == other.Description
&& this.ParticipationStatus == other.ParticipationStatus
&& this.Transparency == other.Transparency
+ && this.ExtendedTransparency == other.ExtendedTransparency
&& this.EventStatus == other.EventStatus
&& this.Recurring == other.Recurring
&& this.MeetingUrl == other.MeetingUrl
diff --git a/src/Cronofy/ExtendedTransparency.cs b/src/Cronofy/ExtendedTransparency.cs
new file mode 100644
index 0000000..fcd4821
--- /dev/null
+++ b/src/Cronofy/ExtendedTransparency.cs
@@ -0,0 +1,39 @@
+namespace Cronofy
+{
+ ///
+ /// Potential extended_transparency values.
+ ///
+ public static class ExtendedTransparency
+ {
+ ///
+ /// The account should appear as busy for the duration of the event.
+ ///
+ public const string Opaque = "opaque";
+
+ ///
+ /// The account should not appear as busy for the duration of the event.
+ ///
+ public const string Transparent = "transparent";
+
+ ///
+ /// Indicates the user is working away from their normal site.
+ ///
+ public const string WorkingElsewhere = "working_elsewhere";
+
+ ///
+ /// Indicates an event being only tentatively accepted.
+ ///
+ public const string Tentative = "tentative";
+
+ ///
+ /// Indicates the user is unavailable due to being out of the office, such as being on vacation.
+ ///
+ public const string OutOfOffice = "out_of_office";
+
+ ///
+ /// The appearance of the account for the duration of the event is not
+ /// known.
+ ///
+ public const string Unknown = "unknown";
+ }
+}
diff --git a/src/Cronofy/Requests/UpsertEventRequest.cs b/src/Cronofy/Requests/UpsertEventRequest.cs
index 1c35598..2f4e111 100644
--- a/src/Cronofy/Requests/UpsertEventRequest.cs
+++ b/src/Cronofy/Requests/UpsertEventRequest.cs
@@ -82,6 +82,15 @@ public sealed class UpsertEventRequest : BaseEventRequest
[JsonProperty("attachments")]
public IEnumerable Attachments { get; set; }
+ ///
+ /// Gets or sets the extended_transparency of the event.
+ ///
+ ///
+ /// The extended_transparency of the event.
+ ///
+ [JsonProperty("extended_transparency")]
+ public string ExtendedTransparency { get; set; }
+
///
/// Class for the serialization of the attendees for an upsert event
/// request.
diff --git a/src/Cronofy/Responses/ReadEventsResponse.cs b/src/Cronofy/Responses/ReadEventsResponse.cs
index 3fab2c1..8078b88 100644
--- a/src/Cronofy/Responses/ReadEventsResponse.cs
+++ b/src/Cronofy/Responses/ReadEventsResponse.cs
@@ -173,6 +173,15 @@ internal sealed class EventResponse
[JsonProperty("transparency")]
public string Transparency { get; set; }
+ ///
+ /// Gets or sets the extended transparency of the event.
+ ///
+ ///
+ /// The extended transparency of the event.
+ ///
+ [JsonProperty("extended_transparency")]
+ public string ExtendedTransparency { get; set; }
+
///
/// Gets or sets the status of the event.
///
@@ -286,6 +295,7 @@ public Event ToEvent()
Deleted = this.Deleted,
ParticipationStatus = this.ParticipationStatus,
Transparency = this.Transparency,
+ ExtendedTransparency = this.ExtendedTransparency,
EventStatus = this.EventStatus,
Categories = this.Categories,
Created = this.Created,
diff --git a/src/Cronofy/UpsertEventRequestBuilder.cs b/src/Cronofy/UpsertEventRequestBuilder.cs
index 066f436..c3a871b 100644
--- a/src/Cronofy/UpsertEventRequestBuilder.cs
+++ b/src/Cronofy/UpsertEventRequestBuilder.cs
@@ -107,6 +107,11 @@ public sealed class UpsertEventRequestBuilder : IBuilder
///
private string transparency;
+ ///
+ /// The extended_transparency of the event.
+ ///
+ private string extendedTransparency;
+
///
/// The color of the event.
///
@@ -601,6 +606,30 @@ public UpsertEventRequestBuilder Transparency(string transparency)
return this;
}
+ ///
+ /// Sets the extended transparency of the event.
+ ///
+ ///
+ /// ExtendedTransparency, must not be empty.
+ ///
+ ///
+ /// A reference to the modified builder.
+ ///
+ ///
+ /// Thrown if is not
+ /// transparent, opaque, working_elsewhere, tentative, or out_of_office.
+ ///
+ public UpsertEventRequestBuilder ExtendedTransparency(string extendedTransparency)
+ {
+ Preconditions.True(
+ new[] { "transparent", "opaque", "working_elsewhere", "tentative", "out_of_office" }.Contains(extendedTransparency),
+ "ExtendedTransparency must be `transparent`, `opaque`, `working_elsewhere`, `tentative`, or `out_of_office`.");
+
+ this.extendedTransparency = extendedTransparency;
+
+ return this;
+ }
+
///
/// Sets the color of the event.
///
@@ -793,6 +822,7 @@ public UpsertEventRequest Build()
End = GetEventTime("End", this.endTime, this.endDate, this.endTimeZoneId),
Url = this.url,
Transparency = this.transparency,
+ ExtendedTransparency = this.extendedTransparency,
TimeZoneId = this.timeZoneId,
Color = this.color,
RemindersCreateOnly = this.remindersCreateOnly,
diff --git a/test/Cronofy.Test/CronofyAccountClientTests/GetEvents.cs b/test/Cronofy.Test/CronofyAccountClientTests/GetEvents.cs
index 75576f8..984202d 100644
--- a/test/Cronofy.Test/CronofyAccountClientTests/GetEvents.cs
+++ b/test/Cronofy.Test/CronofyAccountClientTests/GetEvents.cs
@@ -554,6 +554,100 @@ public void CanGetEventWithMeetingUrl()
events);
}
+ [Test]
+ public void CanGetEventWithExtendedTransparency()
+ {
+ this.Http.Stub(
+ HttpGet
+ .Url("https://api.cronofy.com/v1/events?tzid=Etc%2FUTC&localized_times=true")
+ .RequestHeader("Authorization", "Bearer " + AccessToken)
+ .ResponseCode(200)
+ .ResponseBody(
+ @"{
+ ""pages"": {
+ ""current"": 1,
+ ""total"": 1
+ },
+ ""events"": [
+ {
+ ""calendar_id"": ""cal_U9uuErStTG@EAAAB_IsAsykA2DBTWqQTf-f0kJw"",
+ ""event_uid"": ""evt_external_54008b1a4a41730f8d5c6037"",
+ ""summary"": ""Company Retreat"",
+ ""description"": ""Escape to the country"",
+ ""start"": ""2014-09-06"",
+ ""end"": ""2014-09-08"",
+ ""deleted"": false,
+ ""recurring"": true,
+ ""series_identifier"": ""identifier"",
+ ""participation_status"": ""needs_action"",
+ ""transparency"": ""opaque"",
+ ""extended_transparency"": ""working_elsewhere"",
+ ""status"": ""confirmed"",
+ ""categories"": [],
+ ""attendees"": [
+ {
+ ""email"": ""example@cronofy.com"",
+ ""display_name"": ""Example Person"",
+ ""status"": ""needs_action""
+ }
+ ],
+ ""created"": ""2014-09-01T08:00:01Z"",
+ ""updated"": ""2014-09-01T09:24:16Z"",
+ ""options"": {
+ ""delete"": true,
+ ""update"": true,
+ ""change_participation_status"": true
+ },
+ ""meeting_url"": ""https://meet.example.com/ABCD1234""
+ }
+ ]
+}"));
+
+ var events = this.Client.GetEvents();
+
+ CollectionAssert.AreEqual(
+ new List
+ {
+ new Event
+ {
+ CalendarId = "cal_U9uuErStTG@EAAAB_IsAsykA2DBTWqQTf-f0kJw",
+ EventUid = "evt_external_54008b1a4a41730f8d5c6037",
+ Summary = "Company Retreat",
+ Description = "Escape to the country",
+ Start = new EventTime(new Date(2014, 9, 6), "Etc/UTC"),
+ End = new EventTime(new Date(2014, 9, 8), "Etc/UTC"),
+ Location = null,
+ Deleted = false,
+ Recurring = true,
+ SeriesIdentifier = "identifier",
+ ParticipationStatus = AttendeeStatus.NeedsAction,
+ Transparency = Transparency.Opaque,
+ ExtendedTransparency = ExtendedTransparency.WorkingElsewhere,
+ EventStatus = EventStatus.Confirmed,
+ Categories = new string[] { },
+ Created = new DateTime(2014, 9, 1, 8, 0, 1, DateTimeKind.Utc),
+ Updated = new DateTime(2014, 9, 1, 9, 24, 16, DateTimeKind.Utc),
+ Attendees = new[]
+ {
+ new Attendee
+ {
+ Email = "example@cronofy.com",
+ DisplayName = "Example Person",
+ Status = AttendeeStatus.NeedsAction,
+ },
+ },
+ Options = new EventOptions()
+ {
+ Delete = true,
+ Update = true,
+ ChangeParticipationStatus = true,
+ },
+ MeetingUrl = "https://meet.example.com/ABCD1234",
+ },
+ },
+ events);
+ }
+
[Test]
public void CanGetEventWithOldAuditTimes()
{
diff --git a/test/Cronofy.Test/CronofyAccountClientTests/UpsertEvent.cs b/test/Cronofy.Test/CronofyAccountClientTests/UpsertEvent.cs
index e3a749e..20ae3a7 100644
--- a/test/Cronofy.Test/CronofyAccountClientTests/UpsertEvent.cs
+++ b/test/Cronofy.Test/CronofyAccountClientTests/UpsertEvent.cs
@@ -860,5 +860,51 @@ public void CanUpsertRemovingSubscriptions()
this.Client.UpsertEvent(CalendarId, builder);
}
+
+ [Test]
+ public void CanUpsertEventWithExtendedTransparency()
+ {
+ const string eventId = "qTtZdczOccgaPncGJaCiLg";
+ const string summary = "Board meeting";
+ const string description = "Discuss plans for the next quarter";
+ const string startTimeString = "2014-08-05 15:30:00Z";
+ const string endTimeString = "2014-08-05 17:00:00Z";
+ const string locationDescription = "Board room";
+ const string extendedTransparency = ExtendedTransparency.OutOfOffice;
+
+ this.Http.Stub(
+ HttpPost
+ .Url("https://api.cronofy.com/v1/calendars/" + CalendarId + "/events")
+ .RequestHeader("Authorization", "Bearer " + AccessToken)
+ .RequestHeader("Content-Type", "application/json; charset=utf-8")
+ .RequestBodyFormat(
+ "{{\"event_id\":\"{0}\"," +
+ "\"extended_transparency\":\"{1}\"," +
+ "\"summary\":\"{2}\"," +
+ "\"description\":\"{3}\"," +
+ "\"start\":{{\"time\":\"{4}\",\"tzid\":\"Etc/UTC\"}}," +
+ "\"end\":{{\"time\":\"{5}\",\"tzid\":\"Etc/UTC\"}}," +
+ "\"location\":{{\"description\":\"{6}\"}}" +
+ "}}",
+ eventId,
+ extendedTransparency,
+ summary,
+ description,
+ startTimeString,
+ endTimeString,
+ locationDescription)
+ .ResponseCode(202));
+
+ var builder = new UpsertEventRequestBuilder()
+ .EventId(eventId)
+ .Summary(summary)
+ .Description(description)
+ .Start(new DateTime(2014, 8, 5, 15, 30, 0, DateTimeKind.Utc))
+ .End(new DateTime(2014, 8, 5, 17, 0, 0, DateTimeKind.Utc))
+ .Location(locationDescription)
+ .ExtendedTransparency(extendedTransparency);
+
+ this.Client.UpsertEvent(CalendarId, builder);
+ }
}
}