View Source Dnsimple.Templates (dnsimple v4.0.0)

Provides functions to interact with the template endpoints.

See:

Summary

Functions

Link to this function

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

View Source
@spec 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
@spec 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
@spec 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
@spec 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
@spec 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
@spec 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
@spec 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
@spec 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
@spec 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
@spec 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.",
})