RigCloudEvents.Parser behaviour (Reactive Interaction Gateway v3.0.0-alpha.2) View Source

Tolerant reader for JSON encoded CloudEvents.

Link to this section Summary

Types

A CloudEvents context attribute name.

A CloudEvents extension name.

A JSON Pointer (see RFC 6901).

The JSON encoded CloudEvent.

t()

Callbacks

Fetch the value of a CloudEvents context attribute.

Fetch the value of a CloudEvents extension attribute.

Find a specific value using a JSON Pointer.

Parse a JSON encoded CloudEvent.

Link to this section Types

Specs

attribute() :: String.t()

A CloudEvents context attribute name.

Specs

extension() :: String.t()

A CloudEvents extension name.

Specs

json_pointer() :: String.t()

A JSON Pointer (see RFC 6901).

Specs

json_string() :: String.t()

The JSON encoded CloudEvent.

Specs

t() :: module()

Link to this section Callbacks

Link to this callback

context_attribute(t, attribute)

View Source

Specs

context_attribute(t(), attribute()) ::
  {:ok, value :: any()}
  | {:error, {:not_found, Parser.attribute(), t()}}
  | {:error, {:non_scalar_value, Parser.attribute(), t()}}
  | {:error, any()}

Fetch the value of a CloudEvents context attribute.

Link to this callback

extension_attribute(t, extension, attribute)

View Source

Specs

extension_attribute(t(), extension(), attribute()) ::
  {:ok, value :: any()}
  | {:error, {:not_found, Parser.attribute(), t()}}
  | {:error, {:not_an_object | :non_scalar_value, Parser.attribute(), t()}}
  | {:error, any()}

Fetch the value of a CloudEvents extension attribute.

Link to this callback

find_value(t, json_pointer)

View Source

Specs

find_value(t(), json_pointer()) ::
  {:ok, value :: any()}
  | {:error, {:not_found, location :: String.t(), t()}}
  | {:error, {:non_scalar_value, location :: String.t(), t()}}
  | {:error, any()}

Find a specific value using a JSON Pointer.

Specs

parse(json_string()) :: t()

Parse a JSON encoded CloudEvent.