1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Gun.API do
6 @callback open(charlist(), pos_integer(), map()) :: {:ok, pid()}
7 @callback info(pid()) :: map()
8 @callback close(pid()) :: :ok
9 @callback await_up(pid) :: {:ok, atom()} | {:error, atom()}
10 @callback connect(pid(), map()) :: reference()
11 @callback await(pid(), reference()) :: {:response, :fin, 200, []}
13 def open(host, port, opts), do: api().open(host, port, opts)
15 def info(pid), do: api().info(pid)
17 def close(pid), do: api().close(pid)
19 def await_up(pid), do: api().await_up(pid)
21 def connect(pid, opts), do: api().connect(pid, opts)
23 def await(pid, ref), do: api().await(pid, ref)
25 defp api, do: Pleroma.Config.get([Pleroma.Gun.API], Pleroma.Gun)