Deputy.Constants (Deputy v0.5.0)

Copy Markdown View Source

Named constants for Deputy API magic values.

The Deputy API uses integer codes for many fields. This module provides named constants to avoid magic numbers in application code.

Each child module exposes both:

  • Plain functions (e.g. Gender.male/0) that return the raw value. Use these to build request payloads.
  • defguard-based predicates (e.g. Gender.is_male/1) usable in guards and case clauses for response handling.

Usage

iex> Deputy.Constants.Gender.male()
1

iex> Deputy.Constants.Roster.publish_mode_notify()
1

iex> import Deputy.Constants.LeaveStatus
iex> case 1 do
...>   s when is_approved(s) -> :approved
...>   s when is_pending(s) -> :pending
...>   _ -> :other
...> end
:approved