Initial commit

This commit is contained in:
2021-07-12 14:29:27 +03:00
parent 6c7cd5aee2
commit b48a9f5c58
28 changed files with 472 additions and 13 deletions

View File

@@ -0,0 +1,9 @@
defmodule ExDataGovUA.Decoders.Base do
@type data :: map()
@type status :: Atom.t()
@type async_response :: Stream.t()
@type sync_response :: {status, data}
@type body :: String.t() | Stream.t()
@callback decode(body) :: async_response | sync_response
end

View File

@@ -0,0 +1,8 @@
defmodule ExDataGovUA.Decoders.JasonDecoder do
@behaviour ExDataGovUA.Decoders.Base
@impl true
def decode(data) do
Jason.decode(data, [keys: :atoms])
end
end

View File

@@ -0,0 +1,9 @@
defmodule ExDataGovUA.Decoders.JaxonDecoder do
@behaviour ExDataGovUA.Decoders.Base
@impl true
def decode(stream) do
stream
|> Jaxon.Stream.from_enumerable()
end
end