Current section
Files
Jump to
Current section
Files
lib/teac/api/teams.ex
defmodule Teac.Api.Teams do
def get(opts) do
token = Keyword.fetch!(opts, :token)
client_id = Keyword.get(opts, :client_id, Teac.client_id())
case Req.get!(Teac.api_uri() <> "teams",
headers: [
{"Authorization", "Bearer #{token}"},
{"Client-Id", client_id}
],
params: []
) do
%Req.Response{status: 200, body: %{"data" => data}} -> {:ok, data}
%Req.Response{body: body} -> {:error, body}
end
end
defmodule Channel do
def get(opts) do
token = Keyword.fetch!(opts, :token)
client_id = Keyword.get(opts, :client_id, Teac.client_id())
case Req.get!(Teac.api_uri() <> "teams/channel",
headers: [
{"Authorization", "Bearer #{token}"},
{"Client-Id", client_id}
],
params: []
) do
%Req.Response{status: 200, body: %{"data" => data}} -> {:ok, data}
%Req.Response{body: body} -> {:error, body}
end
end
end
end