diff options
author | Pierre de Lacroix <pierre@pdelacroix.com> | 2020-12-27 00:24:43 +0100 |
---|---|---|
committer | Pierre de Lacroix <pierre@pdelacroix.com> | 2020-12-27 00:24:43 +0100 |
commit | d76110a5ac8abf363c881380092cfb696b8dbc00 (patch) | |
tree | 6e5387ef369d38afc7a064eca783aa142d0d986b /lib/matrix_app_service/client_behaviour.ex | |
parent | Merge branch '8-improve-ci' into 'master' (diff) |
define client behaviour
Diffstat (limited to 'lib/matrix_app_service/client_behaviour.ex')
-rw-r--r-- | lib/matrix_app_service/client_behaviour.ex | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/matrix_app_service/client_behaviour.ex b/lib/matrix_app_service/client_behaviour.ex new file mode 100644 index 0000000..cf56286 --- /dev/null +++ b/lib/matrix_app_service/client_behaviour.ex @@ -0,0 +1,20 @@ +defmodule MatrixAppService.ClientBehaviour do + @moduledoc """ + Behaviour defining callbacks implemented in `MatrixAppService.Client`. Can be used to mock the client, for instance with `mox`: + + TODO: example + """ + + @type client_options :: {:base_url, String.t()} | MatrixAppService.Client.LowLevel.create_opts() + + @callback client() :: + Polyjuice.Client.LowLevel.t() + @callback client([client_options()]) :: + Polyjuice.Client.LowLevel.t() + @callback create_room(Keyword.t()) :: {:ok, String.t()} | Any + @callback create_alias(String.t(), String.t(), client_options()) :: {:ok, String.t()} | Any + @callback send_message(String.t(), String.t(), client_options()) :: {:ok, String.t()} | Any + @callback register(Polyjuice.Client.LowLevel.register_opts(), client_options()) :: + {:ok, String.t()} | Any + @callback get_profile(Polyjuice.Client.LowLevel.t(), String.t()) :: {:ok, map()} | any +end |