Cuerdo.Arazzo.Context (cuerdo v0.1.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

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

Same as new/2 but raises on error

Puts a map of %{input_name => value} in the worfklow_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 request and response structs for the given stepId

Returns the outputs map for the given workflowId.

Types

t()

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

Functions

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

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, resolver \\ Client)

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

Creates a new context

new!(document_data, resolver \\ Client)

@spec new!(map(), module()) :: 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 worfklow_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

step_request_response(context, workflow_id, step_id)

@spec step_request_response(t(), String.t(), String.t()) ::
  %{request: Req.Request.t(), response: Req.Response.t()} | nil

Returns the request and response structs for the given stepId

workflow_outputs(context, workflow_id)

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

Returns the outputs map for the given workflowId.