Epik (Epik v0.2.1) 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.

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."
   }
 }}
Link to this function

register_domain(domain, years)

View Source

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
     }
   }
 }}