Cablegram.ResponseParser (Cablegram v0.2.0)

Handles parsing of data from the API.

This module is used by Cablegram.Request.handle/1 for parsing the response.

Use parse_update when you need to parse an update object obtained via a webhook.

Link to this section Summary

Functions

Used by Cablegram.Request.handle/1 for parsing data, which is already JSON decoded, from an API response.

Parses data, which must already be JSON decoded, as an update. Returns a Cablegram.Models.Update.

Link to this section Functions

Link to this function

parse_result_in_response(data, request, opts \\ default_opts())

Used by Cablegram.Request.handle/1 for parsing data, which is already JSON decoded, from an API response.

The expected type is determined by the request. If the return type of the request method is known, a struct such as Cablegram.Models.User is returned.

Link to this function

parse_update(data, opts \\ default_opts())

Parses data, which must already be JSON decoded, as an update. Returns a Cablegram.Models.Update.

This can be used for parsing updates obtained via a webhook.