Skip to content

Commit

Permalink
♻️ Add HTTP interface
Browse files Browse the repository at this point in the history
  • Loading branch information
WLSF committed Apr 26, 2023
1 parent c044aac commit 8f2f9a3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/http.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defmodule Mater.HTTP do
@moduledoc """
HTTP Client interface to communicate with GraphQL APIs.
"""

def call(),
do: :todo
end
14 changes: 14 additions & 0 deletions lib/http/interface.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defmodule Mater.HTTP.Interface do
@moduledoc """
This module represents the interface functions that
should be implemented when using HTTP Clients to
access a GraphQL API resource.
"""

@type endpoint :: String.t()
@type body :: %{query: String.t(), variables: String.t()}
@type opts :: Keyword.t()
@type response :: {:ok, map()} | {:error, map()}

@callback call(endpoint, body, opts) :: response
end

0 comments on commit 8f2f9a3

Please sign in to comment.