ExScim.Users.Mapper.Adapter behaviour (ex_scim v0.2.0)

Copy Markdown View Source

User resource mapper behaviour.

Summary

Types

A SCIM user resource as a JSON-decoded map.

A domain user struct or map.

Callbacks

Builds the complete SCIM meta object for a user. Receives the struct and options like :location and :resource_type.

Converts a SCIM JSON map into a domain user struct.

Extracts the creation timestamp from a user struct. Used for SCIM meta.created.

Extracts the last-modified timestamp from a user struct. Used for SCIM meta.lastModified.

Computes an ETag version string from a user struct. Used for SCIM meta.version.

Converts a domain user struct into a SCIM JSON map.

Types

scim_data()

@type scim_data() :: map()

A SCIM user resource as a JSON-decoded map.

user_struct()

@type user_struct() :: struct() | map()

A domain user struct or map.

Callbacks

format_meta(user_struct, keyword)

(optional)
@callback format_meta(
  user_struct(),
  keyword()
) :: map()

Builds the complete SCIM meta object for a user. Receives the struct and options like :location and :resource_type.

from_scim(scim_data, t)

@callback from_scim(scim_data(), ExScim.Scope.t()) ::
  {:ok, user_struct()} | {:error, atom() | term()}

Converts a SCIM JSON map into a domain user struct.

get_meta_created(user_struct)

(optional)
@callback get_meta_created(user_struct()) :: DateTime.t() | nil

Extracts the creation timestamp from a user struct. Used for SCIM meta.created.

get_meta_last_modified(user_struct)

(optional)
@callback get_meta_last_modified(user_struct()) :: DateTime.t() | nil

Extracts the last-modified timestamp from a user struct. Used for SCIM meta.lastModified.

get_meta_version(user_struct)

(optional)
@callback get_meta_version(user_struct()) :: String.t() | nil

Computes an ETag version string from a user struct. Used for SCIM meta.version.

to_scim(user_struct, t, keyword)

@callback to_scim(user_struct(), ExScim.Scope.t(), keyword()) ::
  {:ok, scim_data()} | {:error, atom() | term()}

Converts a domain user struct into a SCIM JSON map.