summaryrefslogtreecommitdiff
path: root/lib/matrix_app_service/client_behaviour.ex
blob: 6c69846ca78acb3988e13f8909da131470597eef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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_room(Keyword.t(), client_options()) :: {: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() ::
              {:ok, String.t()} | Any
  @callback register(Polyjuice.Client.LowLevel.register_opts()) ::
              {: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
  @callback get_data(Polyjuice.Client.LowLevel.t(), String.t(), String.t()) :: {:ok, map()} | any
  @callback modify_displayname(Polyjuice.Client.LowLevel.t(), String.t(), String.t()) :: :ok | any
end