Packages
A pretty good Kubo IPFS RPC API client for Elixir.
Retired package: Deprecated - Replaced by ex_ipfs
Current section
Files
Jump to
Current section
Files
lib/myspace_ipfs/structs/hash.ex
defmodule MyspaceIPFS.Hash do
@moduledoc false
@enforce_keys [:hash, :name, :size, :type]
defstruct hash: nil, name: nil, size: nil, target: "", type: nil
@spec new(map) :: MyspaceIPFS.hash()
def new(opts) when is_map(opts) do
%__MODULE__{
hash: opts["Hash"],
name: opts["Name"],
size: opts["Size"],
target: opts["Target"],
type: opts["Type"]
}
end
# Pass on errors.
@spec new({:error, any}) :: {:error, any}
def new({:error, data}), do: {:error, data}
end