defmodule Lab do @moduledoc """ Documentation for Lab. """ use Tesla, docs: false plug Tesla.Middleware.BaseUrl, System.get_env("GITLAB_API_ENDPOINT") plug Tesla.Middleware.Headers, %{"PRIVATE-TOKEN" => System.get_env("GITLAB_API_PRIVATE_TOKEN")} plug Tesla.Middleware.JSON @doc """ Gets all projects available for the authenticated user. Returns `{:ok, [%{id: 1, ...}, %{id: 2, ...}, ...]}`. """ def projects(opts \\ []) do res = get("/projects", [query: opts]) {:ok, res.body } end end