             ## TODO: add more cases.
             %Tesla.Env{status: 200, headers: headers, body: body} -> %{:headers => headers, :body => body}
             %Tesla.Env{status: 500, headers: headers, body: body} -> %{:headers => headers, :body => body}
+            %Tesla.Env{status: 400, headers: headers, body: body} -> %{:headers => headers, :body => body}
             %Tesla.Env{status: 404, headers: headers} -> %{:headers=> headers, :error => "Error: 404 page not found."}
         end
     end

            ## TODO: add more cases.
            %Tesla.Env{status: 200, headers: headers, body: body} -> %{:headers => headers, :body => body}
            %Tesla.Env{status: 500, headers: headers, body: body} -> %{:headers => headers, :body => body}
            %Tesla.Env{status: 404, headers: headers} -> %{:headers=> headers, :error => "Error: 404 page not found."}
        end
    end

defmodule IpfsElixir.Api do

    ## TODO: add (add_cmd, block, bootstrap, config, dag, dht, diag,
    ## files, key, log, mount, name, object, pin, ping, p2p, pubsub,
    ## bitswap, filestore, shutdown, refs, repo, resolve, stats, tar, file)

    import IpfsConnection

    
    # starts the ipfs daemon asynchronously on a elixir thread. 
    # recall this function with the start? of false and a flag of :normal or :kill to shutdown the process.
    # TODO: add ability to add options to the ipfs daemon command. 
    def start_shell(start? \\ true, flag \\ []) do
        {:ok, pid} = Task.start(fn -> System.cmd("ipfs", ["daemon"]) end) 
        if start? == false do
            pid |> shutdown(flag)
        else
            pid
        end
    end

    def id do
        res = requests("/id")
        res.body
        ##TODO: add extra args
    end

    def dns(arg) when is_bitstring(arg) do
