-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to respond to event invites #93
base: main
Are you sure you want to change the base?
Conversation
Useful for retrieving events without a response.
Return details of the user currently logged in.
``` s = spond.Spond(username=username, password=password) events = await s.get_events(response="unanswered") await s.update_event_response(event[0]["id"], accepted=True) await s.clientsession.close() ```
event = await self.get_event(uid) | ||
|
||
membershipId = None | ||
members = event["recipients"]["group"]["members"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a similar test also needed in other functions?
Seems like it might be a good idea maybe?
And if so - it should probably be abstracted out to a separate function?
What do you think @elliot-100 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raise exception if the current user isn't a member of the event's group?
It makes sense that you can't respond to an event if you're not in its group - the event isn't available for you to attend. It's needed because you may or may not be able to read it anyway, depending on visibility settings.
I guess there are other 'write' cases where this should be checked but I'm not really familiar with them. Which ones do you think?
@@ -233,6 +251,9 @@ async def get_events( | |||
(TO DO: probably events for which invites haven't been sent yet?) | |||
Defaults to False for performance reasons. | |||
Uses `scheduled` API parameter. | |||
response : str, optional | |||
Only include events which this response. Valid known options are: | |||
`unanswered`, there may be more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should read "Only include events with this response from the authenticated user ...", to make it clearer that this parameter (unlike the others) is not intrinsic to the event itself.
@@ -43,6 +44,22 @@ async def login(self): | |||
self.chat_url = result["url"] | |||
self.auth = result["auth"] | |||
|
|||
async def get_profile(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the function name get_profile()
should be get_current_profile()
or similar, as the former sounds like a general purpose function to read an arbitrary item, like get_event()
, get_group()
, etc.
I'm wanting to be able to respond programmatically to event invites but there are some missing endpoints in your library. I have added what is required in this PR.
Note while this is working for me I don't use Python often so if you want to merge this please review the code. I'm happy to make any changes required.