Cased.Export (cased v1.0.0)

Data modeling a Cased export.

Link to this section Summary

Functions

Build a request to create an export of audit trail fields.

Build a request to retrieve data about an export.

Build a request to retrieve the export download.

Link to this section Types

Link to this type

create_opt()

Specs

create_opt() ::
  {:audit_trails, [atom()]}
  | {:audit_trail, atom()}
  | {:fields, [String.t()]}
  | {:key, String.t()}
Link to this type

create_opts()

Specs

create_opts() :: [create_opt()]

Specs

get_opt() :: {:key, String.t()}

Specs

get_opts() :: [get_opt()]

Specs

t() :: %Cased.Export{
  audit_trails: [String.t()],
  created_at: DateTime.t(),
  download_url: String.t(),
  events_found_count: non_neg_integer(),
  fields: [String.t()],
  format: String.t(),
  id: String.t(),
  phrase: nil | String.t(),
  state: String.t(),
  updated_at: DateTime.t()
}

Link to this section Functions

Link to this function

create(client, opts \\ [])

Specs

create(client :: Cased.Client.t(), opts :: create_opts()) ::
  Cased.Request.t() | no_return()

Build a request to create an export of audit trail fields.

Options

The following options are available:

  • :audit_trails — The list of audit trails to export
  • :audit_trail — When passing a single audit trail, you can use this instead of :audit_trails.
  • :fields — The fields to export
  • :key — The Cased policy key allowing access to the audit trails and fields.

The only required option is :fields.

  • When both :audit_trail and :audit_trails are omitted, :audit_trail is assumed to be default.
  • When :key is omitted, the key configured for the :audit_trail (or first of :audit_trails) in the client is used.

Response

When the resulting request is sucessfully executed by Cased.Request.run/2 or Cased.Request.run/1, a Cased.Export struct is returned.

Link to this function

get(client, id, opts \\ [])

Specs

get(client :: Cased.Client.t(), id :: String.t(), opts :: get_opts()) ::
  Cased.Request.t()

Build a request to retrieve data about an export.

Options

The following options are available:

  • :key — A Cased policy key allowing access to the export.

When :key is omitted, the key for the :default audit trail is used.

Response

When the resulting request is sucessfully executed by Cased.Request.run/2 or Cased.Request.run/1, a Cased.Export struct is returned.

Example

A basic example:

iex> client
...> |> Cased.Export.get("export_...")
...> |> Cased.Request.run!
%Cased.Export{id: "export_...", ...}
Link to this function

get_download(client, id, opts \\ [])

Specs

get_download(client :: Cased.Client.t(), id :: String.t(), opts :: get_opts()) ::
  Cased.Request.t()

Build a request to retrieve the export download.

Options

The following options are available:

  • :key — A Cased policy key allowing access to the export.

When :key is omitted, the key for the :default audit trail is used.

Response

When the resulting request is sucessfully executed by Cased.Request.run/2 or Cased.Request.run/1, a raw JSON string is returned. The JSON is not decoded automatically.

Example

A basic example:

iex> client
...> |> Cased.Export.get_download("export_...")
...> |> Cased.Request.run!
"{...}"