master_event_id key not present in typings for Event class
I am not sure if this qualifies as a bug or a feature request, I suppose an argument could be made for either. Because I am unsure, I will post my suggested fix here and I am also happy to create a PR to introduce the change if the owners of this repository agree.
I have changes ready to PR here: https://github.com/ahathaway/nylas-nodejs
I am currently using the updated version in my integration, would love to see this pulled into the nylas repo so that I can switch back.
Current typings for Event class in file: node_modules/nylas/lib/models/event.d.ts
export default class Event extends RestfulModel {
calendarId?: string;
iCalUID?: string;
messageId?: string;
title?: string;
description?: string;
owner?: string;
participants?: EventParticipant[];
readOnly?: boolean;
location?: string;
when?: {
start_time?: number;
end_time?: number;
time?: number;
start_date?: string;
end_date?: string;
date?: string;
object?: string;
};
busy?: boolean;
status?: string;
recurrence?: {
rrule: string[];
timezone: string;
};
get start(): string | number | undefined;
set start(val: string | number | undefined);
get end(): string | number | undefined;
set end(val: string | number | undefined);
deleteRequestQueryString(params?: {
[key: string]: any;
}): {
[key: string]: any;
};
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
rsvp(status: string, comment: string, callback: (error: Error | null, data?: Event) => void): Promise<this>;
}
Unfortunately, when there is a recurrence pattern for an event series, and then the user deletes one of those instances (thus producing an override), Nylas sends a different object over the webhook:
{
"account_id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"busy": true,
"calendar_id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"description": null,
"ical_uid": "[email protected]",
"id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"location": null,
"master_event_id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"message_id": null,
"object": "event",
"original_start_time": 1619460000,
"owner": " <[email protected]>",
"participants": [],
"read_only": false,
"status": "cancelled",
"title": "recurring thing with set end date",
"when": {
"end_time": 1619463600,
"object": "timespan",
"start_time": 1619460000
}
}
Notice the master_event_id which indicates that the item is an override event for a series.
I believe this should be added to the type definition as: masterEventId?: string;
Like so:
export default class Event extends RestfulModel {
calendarId?: string;
iCalUID?: string;
messageId?: string;
title?: string;
description?: string;
owner?: string;
participants?: EventParticipant[];
readOnly?: boolean;
location?: string;
masterEventId?: string;
when?: {
start_time?: number;
end_time?: number;
time?: number;
start_date?: string;
end_date?: string;
date?: string;
object?: string;
};
busy?: boolean;
status?: string;
recurrence?: {
rrule: string[];
timezone: string;
};
get start(): string | number | undefined;
set start(val: string | number | undefined);
get end(): string | number | undefined;
set end(val: string | number | undefined);
deleteRequestQueryString(params?: {
[key: string]: any;
}): {
[key: string]: any;
};
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
rsvp(status: string, comment: string, callback: (error: Error | null, data?: Event) => void): Promise<this>;
}
Thoughts on this?
I found another key missing: original_start_time/originalStartTime
Is there any input from the contributing team on this repo? It seems odd that instructions on how to contribute are provided, and then the permissions on this repository are such that the instructions cannot be adhered to (labeling issues for example).
Hey @ahathaway! Thanks for tackling this issue, you are more than welcome to submit a PR! Can you describe what issues you are seeing when attempting to create a PR? I can try to help resolve those issues so we can get the PR started and eventually merged in 😄
Ran into the same issue. Currently manually extending Event right now to access conferencing, originalStartTime and masterEventId, and sending requests with Axios.
https://developer.nylas.com/docs/api/#tag--Events--events-object
(Conferencing isn't available in the above docs, but is available from the API)
Data from the API w/ original values changed:
{
"account_id": "1wvo7bbwtectoslnsppxxxxxx",
"busy": true,
"calendar_id": "6sdp3h5r8p0roprwenpxxxxxx",
"conferencing": {
"details": {
"meeting_code": "00000000000",
"phone": [
"+1000000000"
],
"url": "https://zoom.us/j/00000000000"
},
"provider": "Zoom Meeting"
},
"description": null,
"ical_uid": "[email protected]",
"id": "675pk7k14azwsao2erxxxxxxx",
"location": null,
"master_event_id": "d1jqfyjlgiltadiy1rxxxxxxx",
"message_id": null,
"object": "event",
"original_start_time": 1625508000,
"owner": " <[email protected]>",
"participants": [
{
"comment": null,
"email": "[email protected]",
"name": null,
"status": "yes"
},
{
"comment": null,
"email": "[email protected]",
"name": null,
"status": "noreply"
}
],
"read_only": false,
"reminders": null,
"status": "confirmed",
"title": "My Event",
"when": {
"end_time": 1625598000,
"object": "timespan",
"start_time": 1625594400
}
}
The values original_start_time and master_event_id are now available in the Events object, and will be included in the next minor release!
@dereekb Regarding conferencing, support will be coming very soon - please follow #256 to track the request, thank you!
This has been removed again from the types, I check this PR you referenced, there was an event.ts but now its events.ts and the masterEventId has been excluded again
Reopening this issue, thanks @horlaarsco we'll take a look as soon as we get a chance!
Same seems to be true for resources[]