/
vanity_name_servers.ex
55 lines (39 loc) · 1.7 KB
/
vanity_name_servers.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
defmodule Dnsimple.VanityNameServers do
@moduledoc """
Provides functions to interact with the
[vanity name server endpoints](https://developer.dnsimple.com/v2/vanity/).
See:
- https://developer.dnsimple.com/v2/vanity/
"""
alias Dnsimple.Client
alias Dnsimple.Response
alias Dnsimple.VanityNameServer
@doc """
Enables vanity name servers for the domain.
See:
- https://developer.dnsimple.com/v2/vanity/#enable
## Examples:
client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.VanityNameServers.enable_vanity_name_servers(client, account_id = 1010, domain_id = "example.com")
"""
@spec enable_vanity_name_servers(Client.t, String.t | integer, String.t | integer, Keyword.t) :: {:ok|:error, Response.t}
def enable_vanity_name_servers(client, account_id, domain_id, options \\ []) do
url = Client.versioned("/#{account_id}/vanity/#{domain_id}")
Client.put(client, url, Client.empty_body(), options)
|> Response.parse(%{"data" => [%VanityNameServer{}]})
end
@doc """
Disables vanity name servers for the domain.
See:
- https://developer.dnsimple.com/v2/vanity/#disable
## Examples:
client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.VanityNameServers.disable_vanity_name_servers(client, account_id = 1010, domain_id = "example.com")
"""
@spec disable_vanity_name_servers(Client.t, String.t | integer, String.t | integer, Keyword.t) :: {:ok|:error, Response.t}
def disable_vanity_name_servers(client, account_id, domain_id, options \\ []) do
url = Client.versioned("/#{account_id}/vanity/#{domain_id}")
Client.delete(client, url, options)
|> Response.parse(nil)
end
end