Write an interface for the new functions in Polyjuice
Those functions are implemented in Polyjuice and most of them are used in Kazarma. The objective is to have functions in MatrixAppService.Client that would in turn call the Polyjuice ones, having sane defaults for options and client options (those used to create the Client
struct). Parameters can be (arg1, arg2, [client_options])
or ([options], [client_options])
. This would really simplify usage in Kazarma, which is kinda dirty at the moment.
For an example, see: https://gitlab.com/kazarma/matrix_app_service.ex/-/blob/master/lib/matrix_app_service/client.ex#L98-123
Documentation can be adapted from the one for Polyjuice functions. The ClientBehaviour module should be adapted to. In an ideal world, Kazarma would also be modified to use those new functions instead of the ones that were created using defdelegate
.
For an example of how it changes calls in Kazarma, see:
- before: https://gitlab.com/kazarma/kazarma/-/blob/master/lib/kazarma/matrix/client.ex#L29
- after: https://gitlab.com/kazarma/kazarma/-/blob/master/lib/kazarma/matrix/client.ex#L193
(it's simpler but it also sends nicer client metadata)
-
send_message -
register -
create_room -
search_user -
create_alias -
get_alias -
get_profile -
put_avatar_url -
put_displayname -
get_data -
put_data -
join -
upload -
redact_message