summaryrefslogtreecommitdiff
path: root/lib/matrix_app_service/client_behaviour.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/matrix_app_service/client_behaviour.ex')
-rw-r--r--lib/matrix_app_service/client_behaviour.ex20
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