Wardrik.Operations.Types (wardrik_protocol v0.1.0-rc.1)

Copy Markdown

Converts each operation's input and output between Elixir and the protocol's JSON.

Input is keyword lists and structs. Output is structs, lists and :ok.

Summary

Functions

Converts the operation's JSON output to what an Elixir caller gets.

Converts an Elixir caller's input to the operation's JSON input.

Converts a streamed event and its cursor to {%Wardrik.Event{}, cursor}.

Returns the path segment for value: a string as given, or a struct's ID or name.

Functions

decode(id, output)

@spec decode(String.t(), map() | nil) :: term()

Converts the operation's JSON output to what an Elixir caller gets.

encode(arg1, definition)

@spec encode(String.t(), term()) :: map()

Converts an Elixir caller's input to the operation's JSON input.

event(arg)

@spec event({map(), String.t()}) :: {Wardrik.Event.t(), String.t()}

Converts a streamed event and its cursor to {%Wardrik.Event{}, cursor}.

path(text)

@spec path(String.t() | struct()) :: String.t()

Returns the path segment for value: a string as given, or a struct's ID or name.