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.
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.
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?
| 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.
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.
| self.chat_url = result["url"] | ||
| self.auth = result["auth"] | ||
|
|
||
| async def get_profile(self): |
There was a problem hiding this comment.
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.