# `JSON.LD.DocumentLoader.RemoteDocument`
[🔗](https://github.com/rdf-elixir/jsonld-ex/blob/v1.0.1/lib/json/ld/document_loader/remote_document.ex#L1)

Implementation of the JSON-LD 1.1 Remote Document and Context Retrieval specification.

This module provides both:

1. A struct representing remote documents as specified in https://www.w3.org/TR/json-ld11-api/#remotedocument
2. The core implementation of remote document loading according to
   <https://www.w3.org/TR/json-ld11-api/#remote-document-and-context-retrieval> so that
   custom `JSON.LD.DocumentLoader` implementations can reuse this by calling `load/3` or
   implementing their own loading logic.

## Custom HTTP clients

The default Tesla-based HTTP client is `JSON.LD.DocumentLoader.DefaultClient`.

If you need a custom HTTP client with custom middleware, you can create your own module
that implements a `client/3` function:

    defmodule MyCustomClient do
      def client(headers, url, options) do
        [
          {Tesla.Middleware.Headers, headers},
          # your custom middleware
        ]
        |> Tesla.client()
      end
    end

and configure it as:

    config :json_ld, :http_client, MyCustomClient

# `t`

```elixir
@type t() :: %JSON.LD.DocumentLoader.RemoteDocument{
  content_type: String.t(),
  context_url: String.t() | nil,
  document: any(),
  document_url: String.t(),
  profile: String.t() | nil
}
```

# `default_http_client`

# `http_get`

# `load`

```elixir
@spec load(String.t(), JSON.LD.Options.convertible(), module()) ::
  {:ok, t()} | {:error, any()}
```

Loads a remote document from the given URL.

According to <https://www.w3.org/TR/json-ld11-api/#remote-document-and-context-retrieval>

# `load!`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
