View Source Zendesk.Client.Parser (zendesk v0.0.3)

This module contains functions used in parsing the results of API calls.

In this context, "parsing" occurs after JSON responses have been decoded into a Map with atom keys.

Link to this section Summary

Types

A result from a parsed API call that is streamable (i.e., a pagninated list).

Either a single or list result.

A single result from a parsed API call.

Functions

Provide a default parser in case an Zendesk.Client.Operation doesn't specify one.

Link to this section Types

@type parsed_list_result() :: {:ok, [struct()], Streamable.t()} | {:error, String.t()}

A result from a parsed API call that is streamable (i.e., a pagninated list).

@type parsed_result() :: parsed_single_result() | parsed_list_result()

Either a single or list result.

Link to this type

parsed_single_result()

View Source
@type parsed_single_result() :: {:ok, struct()} | {:error, String.t()}

A single result from a parsed API call.

@type parser_func() :: (Zendesk.Client.Result.t() -> parsed_result())

Link to this section Functions

@spec default_parse(Zendesk.Client.Result.t()) :: parsed_result()

Provide a default parser in case an Zendesk.Client.Operation doesn't specify one.

This just returns the body of the response. This is useful for downloading files, for instance, where there's no transformation that should be done on the result.