medium v0.2.0 Medium.Middlewares.Codec

This module acts as a Tesla middleware in order to process the responses coming from the Medium API.

Summary

Functions

This method is caled when this module is plugged as a middleware, and is in charge of processing the request by

Extract from the response Map the errors. or the response data

Functions

call(env, next, opts)

This method is caled when this module is plugged as a middleware, and is in charge of processing the request by:

  • Handling error responses via descompose_keys/1
  • Converting all CamelCase keys to snake_case via snake_keys/1
  • Converting all string keys to atom keys via string_to_atom_keys/1
descompose_keys(response)
descompose_keys(Map.t) :: Map

Extract from the response Map the errors. or the response data.