Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Extract a Zulip client package (#69)
There are two major components to this library: the Client and the Webhook. The Client consolidates all of the code related to sending Zulip an HTTP request. Most of it is mechanical refactoring, but I added a bit where we store the error response if we get one. Interesting parts of the Client: - Credentials are loaded for each outbound request. I don't think our credentials change often, but hot-swapping these saved us once already! - This reads an environment variable to see whether we're in production. I think that check should be moved out to app logic, but that means adding it everywhere this gets called. I'll do that in a future change so it's easier to test. The Webhook is mostly struct definitions to match the [Zulip documentation]. The weird part of the Webhook is that `display_recipient` is a string when it comes from a public stream message and an array-of-users when it comes from a DM. [Zulip documentation]: https://zulip.com/api/outgoing-webhooks
- Loading branch information