Epik (Epik v0.2.3) View Source
Simple functions for interacting with the Epik v2 API.
Link to this section Summary
Functions
Check the status of domain names, including their price and availability.
Fetch a list of available TLDs from the API.
Returns a list of TLDs compatible with the Epik API.
Register a domain.
Link to this section Functions
Specs
check_domains(domains :: [String.t()]) :: {:ok, HTTPoison.Response.t()} | {:error, any()}
Check the status of domain names, including their price and availability.
iex(1)> Epik.check_domains(["tribes.host", "fediverse.gold"])
{:ok,
%HTTPoison.Response{
status_code: 200,
body: %{
"code" => 1000,
"data" => %{
"FEDIVERSE.GOLD" => %{
"available" => 1,
"domain" => "FEDIVERSE.GOLD",
"premium" => 0,
"price" => 5.49,
"supported" => 1
},
"TRIBES.HOST" => %{
"available" => 0,
"available_reason" => "in use",
"domain" => "TRIBES.HOST",
"premium" => 0,
"supported" => 1
}
},
"message" => "Command completed successfully."
}
}}
Specs
Fetch a list of available TLDs from the API.
iex(1)> Epik.fetch_tlds()
{:ok,
["academy", "accountant", "accountants", "actor", "ae.org", "ag", "agency",
"airforce", "am", "apartments", "app", "archi", "army", "art", "associates",
"at", "attorney", "auction", "audio", "baby", "band", "bar", "bargains",
"bayern", "bazar", "bbs", "be", "beer", "best", "bet", "bible", "bid", "bike",
"bingo", "bio", "bit", "biz", "black", "blackfriday", "blog", "blue", "boats",
"bond", "boston", "boutique", "br.com", "builders", "business", ...]}
Specs
list_tlds() :: [String.t()]
Returns a list of TLDs compatible with the Epik API.
This is useful for client-side validation since some functions like
Epik.check_domains/1
will return an error if any one domain is invalid.
This list is accurate at the time this package was published.
To fetch the current list, use Epik.fetch_tlds/0
.
iex(1)> Epik.list_tlds()
["academy", "accountant", "accountants", "actor", "ae.org", "ag", "agency",
"airforce", "am", "apartments", "app", "archi", "army", "art", "associates",
"at", "attorney", "auction", "audio", "baby", "band", "bar", "bargains",
"bayern", "bazar", "bbs", "be", "beer", "best", "bet", "bible", "bid", "bike",
"bingo", "bio", "bit", "biz", "black", "blackfriday", "blog", "blue", "boats",
"bond", "boston", "boutique", "br.com", "builders", "business", "buzz", "ca",
...]
Specs
register_domain(domain :: String.t(), years :: integer()) :: {:ok, HTTPoison.Response.t()} | {:error, any()}
Register a domain.
iex(1)> Epik.register_domain("fedigold.xyz", 1)
{:ok,
%HTTPoison.Response{
status_code: 200,
body: %{
"code" => 1000,
"data" => %{
"FEDIGOLD.XYZ" => %{
"error" => 0,
"message" => "Successfully created",
"payment" => %{
"error" => 0,
"paymentStatus" => true,
"paymentValue" => 0.99,
"period" => "1",
"pricePerPeriod" => 0.99
},
"paymentStatus" => true,
"paymentValue" => 0.99,
"period" => "1",
"pricePerPeriod" => 0.99
}
},
"message" => "Command completed successfully.",
"period" => "1",
"total" => %{
"amount" => 0.99,
"message" => "Withdraw money successfully",
"method" => "Balance",
"success" => true
}
}
}}