summaryrefslogtreecommitdiff
path: root/lib/matrix_app_service/client_behaviour.ex
blob: e373b73dc8f3a72e06a7057cc96ded3b0ffbad92 (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, map()} | Any
  @callback create_room(Keyword.t(), client_options()) :: {:ok, map()} | 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