Merge remote-tracking branch 'origin/develop' into fix-attachment-dimensions
[akkoma] / lib / pleroma / gun / api.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Gun.API do
6 @behaviour Pleroma.Gun
7
8 alias Pleroma.Gun
9
10 @gun_keys [
11 :connect_timeout,
12 :http_opts,
13 :http2_opts,
14 :protocols,
15 :retry,
16 :retry_timeout,
17 :trace,
18 :transport,
19 :tls_opts,
20 :tcp_opts,
21 :socks_opts,
22 :ws_opts,
23 :supervise
24 ]
25
26 @impl Gun
27 def open(host, port, opts \\ %{}), do: :gun.open(host, port, Map.take(opts, @gun_keys))
28
29 @impl Gun
30 defdelegate info(pid), to: :gun
31
32 @impl Gun
33 defdelegate close(pid), to: :gun
34
35 @impl Gun
36 defdelegate await_up(pid, timeout \\ 5_000), to: :gun
37
38 @impl Gun
39 defdelegate connect(pid, opts), to: :gun
40
41 @impl Gun
42 defdelegate await(pid, ref), to: :gun
43
44 @impl Gun
45 defdelegate set_owner(pid, owner), to: :gun
46 end