diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2020-04-24 20:19:27 -0400 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2020-04-24 20:19:27 -0400 |
commit | 68463ae802e5acd59a4f2369427c87c961415c2e (patch) | |
tree | f91b3e5d666b0c774f5a4de445ef9e731f54a15a /lib/polyjuice/client/endpoint.ex | |
parent | add methods for paginating room history, and manually syncing (diff) |
use a protocol for transforming HTTP responses
Diffstat (limited to 'lib/polyjuice/client/endpoint.ex')
-rw-r--r-- | lib/polyjuice/client/endpoint.ex | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/polyjuice/client/endpoint.ex b/lib/polyjuice/client/endpoint.ex index 97eb277..1b6b7b5 100644 --- a/lib/polyjuice/client/endpoint.ex +++ b/lib/polyjuice/client/endpoint.ex @@ -31,15 +31,13 @@ defmodule Polyjuice.Client.Endpoint do headers: [{String.t(), String.t()}], url: String.t(), body: String.t(), - transform: (integer, [{String.t(), String.t()}, ...], String.t() -> any), auth_required: true | false } - @enforce_keys [:method, :headers, :url, :transform] + @enforce_keys [:method, :headers, :url] defstruct [ :method, :headers, :url, - :transform, body: "", auth_required: true ] @@ -58,5 +56,16 @@ defmodule Polyjuice.Client.Endpoint do base_url :: String.t() ) :: Polyjuice.Client.Endpoint.HttpSpec.t() def http_spec(endpoint_args, base_url) + + @doc """ + Transform the HTTP result into a return value. + """ + @spec transform_http_result( + endpoint_args :: __MODULE__.t(), + status_code :: integer(), + headers :: [{String.t(), String.t()}, ...], + body :: String.t() + ) :: any + def transform_http_result(endpoint_args, status_code, headers, body) end end |