View Source Philtre.Block behaviour (philtre v0.11.1)

Defines what the structure of a block should be

Link to this section Summary

Callbacks

Takes the struct for the specific block type and returns its data serialized as a json-encodeable map with string keys.

Takes the struct for the specific block type and returns its id

Takes in the block id and the serialized data and returns the struct for the block.

Takes the struct for the specific block type and returns its string type

Link to this section Callbacks

@callback data(struct()) :: %{required(String.t()) => any()}

Takes the struct for the specific block type and returns its data serialized as a json-encodeable map with string keys.

@callback id(struct()) :: String.t()

Takes the struct for the specific block type and returns its id

@callback normalize(String.t(), any()) :: struct()

Takes in the block id and the serialized data and returns the struct for the block.

@callback type(struct()) :: String.t()

Takes the struct for the specific block type and returns its string type