calcinator v1.0.0 Calcinator.View behaviour

A view for Calcinator.Resources

Summary

Types

pagination or nil if no pagination

The raw request params that need to be parsed for view options

The subject that must be authorized to view the individual attributes in the view

Callbacks

Renders list of struct with optional pagination, params, and subject (for view-level authorization of individual attributes). base_uri is required when pagination is present

Renders the show iodata for the given struct and optional params and subject (for view-level authorization of individual attributes)

Types

maybe_pagination()
maybe_pagination() :: nil | pagination

pagination or nil if no pagination

pagination()
pagination() :: map
params()
params() :: %{optional(String.t) => term}

The raw request params that need to be parsed for view options

subject()
subject() :: term

The subject that must be authorized to view the individual attributes in the view.

Callbacks

index(list, %{})
index([struct], %{optional(:base_uri) => URI.t, optional(:pagination) => maybe_pagination, optional(:params) => params, optional(:subject) => subject}) :: iodata

Renders list of struct with optional pagination, params, and subject (for view-level authorization of individual attributes). base_uri is required when pagination is present.

show(struct, %{})
show(struct, %{optional(:params) => params, optional(:subject) => subject}) :: iodata

Renders the show iodata for the given struct and optional params and subject (for view-level authorization of individual attributes).