AccessGrid.CardTemplate (AccessGrid v0.1.0)

Copy Markdown View Source

Represents a full card template configuration.

This struct contains all template data as returned by AccessGrid.Console.read_template/2.

For minimal representations, see:

Summary

Functions

Creates a CardTemplate struct from an API response map.

Types

t()

@type t() :: %AccessGrid.CardTemplate{
  active_keys_count: integer() | nil,
  allow_on_multiple_devices: boolean() | nil,
  background_color: String.t() | nil,
  created_at: String.t() | nil,
  credential_profiles: [String.t()],
  id: String.t() | nil,
  iphone_count: integer() | nil,
  issued_keys_count: integer() | nil,
  label_color: String.t() | nil,
  label_secondary_color: String.t() | nil,
  landing_pages: [String.t()],
  last_published_at: String.t() | nil,
  metadata: map(),
  name: String.t() | nil,
  platform: String.t() | nil,
  privacy_policy_url: String.t() | nil,
  protocol: String.t() | nil,
  support_email: String.t() | nil,
  support_phone_number: String.t() | nil,
  support_url: String.t() | nil,
  terms_and_conditions_url: String.t() | nil,
  use_case: String.t() | nil,
  watch_count: integer() | nil
}

Functions

from_response(data)

@spec from_response(map()) :: t()

Creates a CardTemplate struct from an API response map.

Rails groups some fields under nested objects (allowed_device_counts, support_settings, terms_settings, style_settings) and renames a few along the way (e.g. wire support_settings.url → struct :support_url). This function does the flatten + rename so the struct's field names match the request param names. Symmetric: write background_color: "..." on create, read template.background_color on get.