Add extra parameters to `get_events()` method
Closed this issue · 3 comments
At the moment there isn't a general-purpose method to get events.
e.g. getEvents
can only get up to 100 events, and defaults to last 14 days; getEventsBetween
can get more but requires date parameters. There is no way of restricting events to a Group.
I propose that get_events
(PEP 8 naming as per #24) is expanded to:
- Default to a max, probably 100 for performance reasons, as
getEventsBetween
does now. - Optional before/after datetime parameters, as
getEventsBetween
requires now (although I think the names could better reflect what they do) - Optional Group ID filter parameter, as per #14
- Other optional parameters can then be added over time.
It might make sense to then have some supplementary 'shortcut' methods, but get_events_between
may be redundant; I think it's too early to worry about backward compatibility.
I'm writing a PR for this, but any thoughts?
I totally agree.
It makes more sense to have a "generic" get_events
with optional parameters, than different functions to basically do the same thing.
Pull request to implement this: #30
This does delete get_events_between(from_date, to_date)
, as it is functionally replaced by get_events(min_end, max_end)
.
Parameters are renamed (and added to) to better reflect the API parameters and what they actually do:
max_end : datetime, optional
Only include events which end before or at this datetime.
Defaults to 100 for performance reasons.
Uses `maxEndTimestamp` API parameter; relates to `endTimestamp` event attribute.
max_start : datetime, optional
Only include events which start before or at this datetime.
Defaults to 100 for performance reasons.
Uses `maxStartTimestamp` API parameter; relates to `startTimestamp` event attribute.
min_end : datetime, optional
Only include events which end after or at this datetime.
Uses `minEndTimestamp` API parameter; relates to `endTimestamp` event attribute.
min_start : datetime, optional
Only include events which start after or at this datetime.
Uses `minStartTimestamp` API parameter; relates to `startTimestamp` event attribute.
Thank you!