Class: Workflow

Workflow(idopt, nameopt, statesopt)

Represents a workflow in Shortcut, which contains a sequence of states that stories can progress through.

Constructor

new Workflow(idopt, nameopt, statesopt)

Creates a new Workflow instance

Parameters:
Name Type Attributes Default Description
id number <optional>
0

The workflow's unique identifier

name string <optional>
""

The name of the workflow

states Array.<WorkflowState> <optional>
[]

The states associated with this workflow

Source:

Extends

Classes

Workflow
Workflow

Members

client

The Shortcut API client instance used for making API requests

Overrides:
Source:

context

The VS Code extension context

Overrides:
Source:

id

Unique identifier for the workflow

Source:

id :number

Unique identifier for the workflow

Type:
  • number
Source:

name

Name of the workflow

Source:

name :string

Name of the workflow

Type:
  • string
Source:

states

Array of workflow states that stories can be in

Source:

states :Array

Array of workflow states that stories can be in

Type:
  • Array
Source:

Methods

(static) cacheKey(workspaceName) → {string}

Generates a cache key for storing workflow data

Parameters:
Name Type Description
workspaceName string

Name of the workspace

Source:
Returns:

Cache key string

Type
string

(static) cacheKey(workspaceName) → {string}

Generates a cache key for storing workflow data

Parameters:
Name Type Description
workspaceName string

Name of the workspace

Source:
Returns:

Cache key string

Type
string

(static) deleteCache(workspaceName)

Removes workflows from the cache for a given workspace

Parameters:
Name Type Description
workspaceName string

Name of the workspace to clear cache for

Source:

(static) deleteCache(workspaceName)

Removes workflows from the cache for a given workspace

Parameters:
Name Type Description
workspaceName string

Name of the workspace to clear cache for

Source:

(async, static) fetch(workspace) → {Promise.<Array.<Workflow>>}

Fetches workflows from the Shortcut API

Parameters:
Name Type Description
workspace Workspace

The workspace to fetch workflows for

Source:
Returns:

Promise resolving to array of workflows

Type
Promise.<Array.<Workflow>>

(async, static) fetch(workspace) → {Promise.<Array.<Workflow>>}

Fetches workflows from the Shortcut API

Parameters:
Name Type Description
workspace Workspace

The workspace to fetch workflows for

Source:
Returns:

Promise resolving to array of workflows

Type
Promise.<Array.<Workflow>>

(static) fetchFromCache(workspaceName) → {Array.<Workflow>|null}

Retrieves workflows from the local cache

Parameters:
Name Type Description
workspaceName string

Name of the workspace to get cached workflows for

Source:
Returns:

Array of workflows if found in cache, null otherwise

Type
Array.<Workflow> | null

(static) fetchFromCache(workspaceName) → {Array.<Workflow>|null}

Retrieves workflows from the local cache

Parameters:
Name Type Description
workspaceName string

Name of the workspace to get cached workflows for

Source:
Returns:

Array of workflows if found in cache, null otherwise

Type
Array.<Workflow> | null

(static) fromJson(json) → {Array.<Workflow>}

Creates an array of Workflow instances from JSON data

Parameters:
Name Type Description
json any

The JSON data to parse

Source:
Returns:

Array of Workflow instances

Type
Array.<Workflow>

(static) fromJson(json) → {Array.<Workflow>}

Creates an array of Workflow instances from JSON data

Parameters:
Name Type Description
json any

The JSON data to parse

Source:
Returns:

Array of Workflow instances

Type
Array.<Workflow>

(async, static) get(workspace) → {Promise.<Array.<Workflow>>}

Gets workflows either from cache or fetches from API if not cached

Parameters:
Name Type Description
workspace Workspace

The workspace to get workflows for

Source:
Returns:

Promise resolving to array of workflows

Type
Promise.<Array.<Workflow>>

(async, static) get(workspace) → {Promise.<Array.<Workflow>>}

Gets workflows either from cache or fetches from API if not cached

Parameters:
Name Type Description
workspace Workspace

The workspace to get workflows for

Source:
Returns:

Promise resolving to array of workflows

Type
Promise.<Array.<Workflow>>

(async, static) saveToCache(workspaceName, workflows)

Saves workflows to the local cache

Parameters:
Name Type Description
workspaceName string

Name of the workspace the workflows belong to

workflows Array.<Workflow>

Array of workflows to cache

Source:

(async, static) saveToCache(workspaceName, workflows)

Saves workflows to the local cache

Parameters:
Name Type Description
workspaceName string

Name of the workspace the workflows belong to

workflows Array.<Workflow>

Array of workflows to cache

Source:

toObject() → {object}

Converts the workflow instance to a plain JavaScript object

Source:
Returns:

Plain object representation of the workflow

Type
object

toObject() → {object}

Converts the workflow instance to a plain JavaScript object

Source:
Returns:

Plain object representation of the workflow

Type
object