API Reference

FLOW API Reference

Detailed reference for the FLOW interface in Wayvo.


The FLOW interface in Wayvo provides a comprehensive set of methods for managing flow instances and their state. This reference outlines each method available in the FLOW interface, including its purpose, parameters, and return types.

Methods

getFlowInput

getFlowInput: <T>(key?: string) => T | undefined

Gets the input of the current flow instance.

  • key: The key of the input. If not provided, returns the entire input object.
  • Returns: The input of the FLOW instance, or undefined if the input does not exist.

getFlowInstanceState

getFlowInstanceState: <T>(key: string) => Promise<T | undefined>

Gets the value of a state variable from the current flow instance.

  • key: The key of the state variable.
  • Returns: A Promise that resolves to the value of the state variable, or undefined if the state variable does not exist.

getFlowState

getFlowState: <T>(key: string) => Promise<T | undefined>

Gets the value of a state variable from the current flow.

  • key: The key of the state variable.
  • Returns: A Promise that resolves to the value of the state variable, or undefined if the state variable does not exist.

getNodeOutput

getNodeOutput: <T>(id: string, key?: string) => T | undefined

Gets the output of a node from the current flow instance.

  • nodeId: The ID of the node.
  • key: The key of the output. If not provided, returns the entire output object.
  • Returns: The output of the node, or undefined if the output does not exist.

getResource

getResource: <T>(resourceId: string) => Promise<T | undefined>

Gets a resource.

  • resourceId: The ID of the resource.
  • Returns: A Promise that resolves to the resource, or undefined if the resource does not exist or the current user doesn't have access.

getVariable

getVariable: (name: string) => Promise<string | undefined>

Gets the value of a variable.

  • name: The name of the variable.
  • Returns: A Promise that resolves to the value of the variable, or undefined if the variable does not exist.

incrementAndGetFlowInstanceState

incrementAndGetFlowInstanceState: (key: string, increment: number) => Promise<number>

Increments the value of a state variable in the current flow instance and returns the new value.

  • key: The key of the state variable.
  • increment: The amount to increment the state variable by.
  • Returns: A Promise that resolves to the new value of the state variable.

incrementAndGetFlowState

incrementAndGetFlowState: (key: string, increment: number) => Promise<number>

Increments the value of a state variable in the current flow and returns the new value.

  • key: The key of the state variable.
  • increment: The amount to increment the state variable by.
  • Returns: A Promise that resolves to the new value of the state variable.

setFlowInstanceState

setFlowInstanceState: <T>(key: string, value: T) => Promise<void>

Sets the value of a state variable in the current flow instance.

  • key: The key of the state variable.
  • value: The value to set the state variable to.
  • Returns: A Promise that resolves when the state variable has been set.

setFlowState

setFlowState: <T>(key: string, value: T) => Promise<void>

Sets the value of a state variable in the current flow.

  • key: The key of the state variable.
  • value: The value to set the state variable to.
  • Returns: A Promise that resolves when the state variable has been set.

setVariable

setVariable: (name: string, value: string) => Promise<void>

Sets the value of a variable.

  • name: The name of the variable.
  • value: The value to set the variable to.
  • Returns: A Promise that resolves when the variable has been set.

getFlowRunId

getFlowRunId: () => string

Gets the ID of the current flow instance.

  • Returns: The ID of the current flow instance.

cancelFlow

cancelFlow: () => Promise<void>

Cancels the current flow instance.

  • Returns: A Promise that resolves when the flow instance has been canceled.
Previous
DB