ApiCommons.Request (ApiCommons v0.1.0) View Source

Describe REST API request information in Plug.Conn.
Use private field "private" of Plug.Conn.

https://hexdocs.pm/plug/Plug.Conn.html

Link to this section Summary

Functions

Put initial values into Plug.Conn for further processing.

A map of errors that occured during processing of received parameter.

Fetch library information from Plug.Conn.

Merge parameters from Plug.Conn and parameters received at endpoint.
Puts the merged parameter into a map.

## Parameter
    - conn (Plug.Conn) 
    - params (Map)

## Returns
    - Map containing all parameters %{path: [], query: [], body: []}

## Examples

Fetch filter information available.

Access parsed data stored in the request struct.

Create a new request struct from parameters Returns: %Request{}

Parsed pagination information

Put schema for parameter valdation in Plug.Conn

Remove library information from Plug.Conn.

Add base library information Plug.Conn.

Is the current request still valid?

Link to this section Types

Specs

separated() :: {map(), Plug.Conn.t()}

Specs

t() :: %ApiCommons.Request{
  __meta__: map(),
  errors: map(),
  parsed: map(),
  valid?: boolean()
}

Link to this section Functions

Put initial values into Plug.Conn for further processing.

A map of errors that occured during processing of received parameter.

Returns: Map

Fetch library information from Plug.Conn.

Returns: {Map, Plug.Conn}

Merge parameters from Plug.Conn and parameters received at endpoint.
Puts the merged parameter into a map.

## Parameter
    - conn (Plug.Conn) 
    - params (Map)

## Returns
    - Map containing all parameters %{path: [], query: [], body: []}

## Examples

Fetch filter information available.

Returns: Map

Access parsed data stored in the request struct.

Parameter

Link to this function

get(conn, key, default \\ nil)

View Source
Link to this function

header(conn, header_key)

View Source

Create a new request struct from parameters Returns: %Request{}

Parsed pagination information

Returns: Map

Put schema for parameter valdation in Plug.Conn

Specs

separate(Plug.Conn.t()) :: tuple()

Remove library information from Plug.Conn.

Add base library information Plug.Conn.

Returns: Plug.Conn

Is the current request still valid?

Returns: boolean