Dnsimple.Templates (dnsimple v3.1.0) View Source

Provides functions to interact with the template endpoints.

See:

Link to this section Summary

Link to this section Functions

Link to this function

apply_template(client, account_id, domain_id, template_id, options \\ [])

View Source

Specs

apply_template(
  Dnsimple.Client.t(),
  String.t() | integer(),
  String.t() | integer(),
  String.t() | integer(),
  Keyword.t()
) :: {:ok | :error, Dnsimple.Response.t()}

Applies a template to a domain.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.apply_template(client, account_id = 1010, domain_id = "example.com", template_id = "alpha")
Link to this function

create_template(client, account_id, attributes, options \\ [])

View Source

Specs

create_template(Dnsimple.Client.t(), String.t() | integer(), map(), Keyword.t()) ::
  {:ok | :error, Dnsimple.Response.t()}

Creates a new template.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.create_template(client, account_id = 1010, %{
  name: "Beta",
  short_name: "beta",
  description: "A beta template.",
})
Link to this function

create_template_record(client, account_id, template_id, attributes, options \\ [])

View Source

Specs

create_template_record(
  Dnsimple.Client.t(),
  String.t() | integer(),
  String.t() | integer(),
  map(),
  Keyword.t()
) :: {:ok | :error, Dnsimple.Response.t()}

Creates a new record in the template.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.create_template_record(client, account_id = 1010, template_id = "alpha" %{
  name: "",
  type: "mx",
  content: "mx.example.com",
  ttl: 600,
  prio: 10,
})
Link to this function

delete_template(client, account_id, template_id, options \\ [])

View Source

Specs

delete_template(
  Dnsimple.Client.t(),
  String.t() | integer(),
  String.t() | integer(),
  Keyword.t()
) :: {:ok | :error, Dnsimple.Response.t()}

Deletes a template.

Warning: this is a destructive operation.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.delete_template(client, account_id = 1010, template_id = "alpha")
Link to this function

delete_template_record(client, account_id, template_id, record_id, options \\ [])

View Source

Specs

delete_template_record(
  Dnsimple.Client.t(),
  String.t() | integer(),
  String.t() | integer(),
  integer(),
  Keyword.t()
) :: {:ok | :error, Dnsimple.Response.t()}

Deletes a record from a template.

Warning: this is a destructive operation.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.delete_template_record(client, account_id = 1010, template_id = "alpha", record_id = 1)
Link to this function

get_template(client, account_id, template_id, options \\ [])

View Source

Specs

get_template(
  Dnsimple.Client.t(),
  String.t() | integer(),
  String.t() | integer(),
  Keyword.t()
) :: {:ok | :error, Dnsimple.Response.t()}

Returns a template.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.get_template(client, account_id = 1010, template_id = "alpha")
Link to this function

get_template_record(client, account_id, template_id, record_id, options \\ [])

View Source

Specs

get_template_record(
  Dnsimple.Client.t(),
  String.t() | integer(),
  String.t() | integer(),
  integer(),
  Keyword.t()
) :: {:ok | :error, Dnsimple.Response.t()}

Returns a record of the template.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.get_template_record(client, account_id = 1010, template_id = "alpha", record_id = 123)
Link to this function

list_template_records(client, account_id, template_id, options \\ [])

View Source

Specs

list_template_records(
  Dnsimple.Client.t(),
  String.t() | integer(),
  String.t() | integer(),
  Keyword.t()
) :: {:ok | :error, Dnsimple.Response.t()}

Returns the list of records in the template.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.list_template_records(client, account_id = 1010, template_id = 1)
Dnsimple.Templates.list_template_records(client, account_id = 1010, template_id = 1, sort: "type:asc")
Link to this function

list_templates(client, account_id, options \\ [])

View Source

Specs

list_templates(Dnsimple.Client.t(), String.t() | integer(), Keyword.t()) ::
  {:ok | :error, Dnsimple.Response.t()}

Returns the list of existing templates in the account.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.list_templates(client, account_id = 1010)
{:ok, response} = Dnsimple.Templates.list_templates(client, account_id = 1010, sort: "name:asc")
Link to this function

update_template(client, account_id, template_id, attributes, options \\ [])

View Source

Specs

update_template(
  Dnsimple.Client.t(),
  String.t() | integer(),
  String.t() | integer(),
  map(),
  Keyword.t()
) :: {:ok | :error, Dnsimple.Response.t()}

Updates an existing template.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Templates.update_template(client, account_id = 1010, template_id = 1, %{
  name: "Beta",
  short_name: "beta",
  description: "A beta template.",
})