Optional GA4GH Refget sequence fetch.
allow_network must be true. The default is false, and CRAM.open/2 does
not build this provider. The response body is returned only after its MD5
matches the requested checksum. The body is not placed in the error.
Summary
Types
A Refget base URL.
:base_url— sequence endpoint prefix, without a trailing slash:allow_network— false until the caller opts in. The default is falseiex> {:ok, client} = CRAM.Reference.Refget.new("http://127.0.0.1:9/") iex> client.allow_network false
Functions
Fetch name from Refget when the network is allowed.
expected_md5 must be 32 hex digits. With allow_network: false, returns
reason: :network_disabled and does not connect. With the network allowed,
the body is returned only after its MD5 matches. A mismatch is
reason: :reference_checksum_mismatch. The body is not placed on the error.
iex> {:ok, client} = CRAM.Reference.Refget.new("http://127.0.0.1:9")
iex> {:error, error} = CRAM.Reference.Refget.fetch(client, "sq0", "be19336b7e15968f7ac7dc82493d9cd8")
iex> error.reason
:network_disabled
@spec new(String.t(), keyword()) :: {:ok, t()} | {:error, CRAM.Error.t()}
Build a Refget client.
base_url is a string. A trailing slash is removed. opts may include
:allow_network, which must be a boolean and defaults to false. Returns
{:ok, client}. A non-boolean flag is reason: :invalid_range. Does not
connect.
iex> {:ok, client} = CRAM.Reference.Refget.new("http://127.0.0.1:9/", allow_network: false)
iex> client.base_url
"http://127.0.0.1:9"
iex> {:error, error} = CRAM.Reference.Refget.new("http://127.0.0.1:9", allow_network: "yes")
iex> error.reason
:invalid_range