View Source FLHook.Result (FLHook Client v1.0.0)

A struct that contains result data and provides helpers to decode the contained data.

Link to this section Summary

Functions

Converts the result to a file string. May raise when the result is no file.

Converts the result to a file stream. May raise when the result is no file.

Fetches the param with the specified key from the params collection. Optionally allows specification of a type to coerce the param to.

Fetches the param with the specified key from the params collection. Optionally allows specification of a type to coerce the param to. Raises when the param is missing or could not be coerced to the given type.

Converts a result to params. When the result has multiple lines only the first one is being processed.

Converts a multiline result to a params list.

Converts the result to a string.

Link to this section Types

Specs

t() :: %FLHook.Result{lines: [String.t()]}

Link to this section Functions

Specs

file!(t()) :: String.t() | no_return()

Converts the result to a file string. May raise when the result is no file.

Specs

file_stream!(t()) :: Enum.t() | no_return()

Converts the result to a file stream. May raise when the result is no file.

Link to this function

param(result, key, type \\ :string)

View Source

Specs

param(t(), FLHook.Params.key(), FLHook.Params.param_type()) ::
  {:ok, any()} | {:error, FLHook.ParamError.t()}

Fetches the param with the specified key from the params collection. Optionally allows specification of a type to coerce the param to.

Link to this function

param!(result, key, type \\ :string)

View Source

Specs

Fetches the param with the specified key from the params collection. Optionally allows specification of a type to coerce the param to. Raises when the param is missing or could not be coerced to the given type.

Specs

params(t()) :: FLHook.Params.t()

Converts a result to params. When the result has multiple lines only the first one is being processed.

Specs

params_list(t()) :: [FLHook.Params.t()]

Converts a multiline result to a params list.

Specs

to_string(t()) :: String.t()

Converts the result to a string.