Now the development API (which is inside the repo, api/) is used when the envionment is a development one.
Credits to Steve Howell (@showell) for the instructions on how to fix this.
- Expose some information about user profile in `RestrictedClient`
class, like `full_name` and `email` of the user.
- Add `client` argument to `triage_message()`, now it's possible to
call bot with another method instead of calling the specified
keyword.
This required instead exempting these files:
bots/jabber_mirror_backend.py
tools/deprecated/iframe-bot/show-last-messages
Turning on mypy for the API exposes issues in the annotations
of other files.
We used to create endpoints with Client._register.
Now we now have explicit methods for the endpoints.
This allows us to add docstrings and stricter mypy annotations.
This fix also introduces a call_endpoint() method that avoids
the need for manually building urls with API_VERSTRING when you
know the URL pattern of the endpoint you want to hit (and when
the API doesn't have a convenient wrapper).
I fixed a bug with create_users where it now uses PUT instead
of POST.
I also removed client.export(), which was just broken.
I had to change recent-messages and zulip-export, which were
using client.do_api_query and Client._register.
Now it's easier to just call client.call_endpoint() for
situations where our API doesn't have convenient wrappers,
so that's what I did with those scripts.
Allow to import code from subdirectory of `contrib_bots/lib`.
Because sometimes bot requires grouping in their directory,
especially for the bot that has configuartion file and documentation.
Note that we still can't run mypy against this file and other files,
because of how the interface is dynamically created via _register. We
will need to change that or use a stub file to make it possible to
annotate this.
This was tweaked by tabbott to fix some bugs.