Reputation: 4305
I'm implementing the client that can patch Google Calendar Event via Calendar API v3 Client Library for Java.
method:
com.google.api.services.calendar.Calendar.Events#patch
The problem that I faced is that start
and end
fields in com.google.api.services.calendar.model.Event
entity are complex objects and require several things to be constructed:
com.google.api.client.util.DateTime
TimeZone
DateTime has fields called dateOnly
that is set to true/false depending on whether the event is all day event or not. Here the problem comes. If I want to update only the date, and only the date is sent from my Front-End(without the flag whether it is all day event or dateOnly
is applicable), I can't construct DateTime
object because I don't know whether I should use constructor of DateTime
with dateOnly
set to true or set to false.
In terms if request, it's correct. Since we have PATCH, we can update particular fields without even touching the rest. However, in this case, since the field is rather complex, it's rather difficult to find the way no to update dateOnly
flag, but to update
value or tzShift
.
I consider loading event from Google every time I do patch. Thus, I can read and set dateOnly
flag to the old value. Is there a more convenient way to address the issue?
Upvotes: 1
Views: 337
Reputation: 224
As per documentation in Events there is no dateOnly resource found. but you can use below options using patch Events: patch
{
"start": {
"date": "2017-05-05",
"dateTime": "",
"timeZone": "America/Los_Angeles"
},
"end": {
"date": "2017-05-06",
"dateTime": "",
"timeZone": "America/Los_Angeles"
}
}
Hope it may help you.
Upvotes: 0