Cuerdo.Arazzo.Context (cuerdo v0.4.0)

Copy Markdown

Internal Arazzo Context. Stores workflows and steps inputs/outputs, request/response, etc.

Summary

Functions

Fetch a source description by name. Returns {:ok, source_description, updated_context} on success, or an error tuple

Creates a new Context, using an existing context as base

Returns the source description name for a given operation path or id

Creates a new context

Same as new/2 but raises on error

Puts a map of %{input_name => value} in the workflow_id inputs. Returns the updated context

Sets the source description value to the given schema. Returns the updated context

Returns the outputs map for the given stepId, or an empty map if the step does not define any outputs

Returns the outputs map for the given workflowId.

Types

t()

@type t() :: %Cuerdo.Arazzo.Context{
  api_calls: term(),
  api_calls_global_ref: term(),
  cache: term(),
  client: term(),
  document: term(),
  inputs: term(),
  outputs: term(),
  resolver: term()
}

Functions

api_calls(context)

clear_api_calls(context)

fetch_source_description(context, name)

@spec fetch_source_description(t(), binary()) ::
  {:ok, map(), t()} | {:error, Exception.t()}

Fetch a source description by name. Returns {:ok, source_description, updated_context} on success, or an error tuple

fetch_step_response(context, workflow_id, step_id)

from_base(ctx, document)

@spec from_base(t(), map()) :: {:ok, t()} | {:error, Exception.t()}

Creates a new Context, using an existing context as base

get_source_description_name(op_path_or_id, ctx)

@spec get_source_description_name(String.t(), t()) :: String.t()

Returns the source description name for a given operation path or id

new(document_data, opts \\ [])

@spec new(map(), Keyword.t()) :: {:ok, t()} | {:error, Exception.t()}

Creates a new context

new!(document_data, opts \\ [])

@spec new!(map(), Keyword.t()) :: t()

Same as new/2 but raises on error

put_inputs(ctx, workflow_id, workflow_inputs)

@spec put_inputs(t(), String.t(), map()) :: t()

Puts a map of %{input_name => value} in the workflow_id inputs. Returns the updated context

put_source_description(context, name, schema)

@spec put_source_description(t(), String.t(), map()) :: t()

Sets the source description value to the given schema. Returns the updated context

step_outputs(context, workflow_id, step_id)

@spec step_outputs(t(), String.t(), String.t()) :: map()

Returns the outputs map for the given stepId, or an empty map if the step does not define any outputs

workflow_outputs(context, workflow_id)

@spec workflow_outputs(t(), String.t()) :: map()

Returns the outputs map for the given workflowId.