snowhite v2.1.3 Snowhite.Modules.News.Adapters.Json View Source

The JSON adapter can be used to fetch JSON endpoints. It must have a item_mapper to know how each fields are mapped since every JSON endpoints behaves differently. It also supports couples of HTTP options to customize the underlying HTTPoison.request/5 call.

Options

  • item_mapper required: A MF ({module, funciton}) that received two arguments, the json payload and the options. This function must return a list of Item.t().
  • body (default GET): The method to use for the HTTP call.
  • headers (default []): Headers for the HTTP call.
  • body (default ""): Body content, in case of a non-GET call.
  • http_poison_options (default []): Other option for HTTPoison.

Link to this section Summary

Link to this section Functions

Callback implementation for Snowhite.Modules.News.Adapter.fetch/2.