[@qualtrics/workflows-task-client](../README.md) › [Globals](../globals.md) › ["actionsTaskClient"](../modules/_actionstaskclient_.md) › [ActionsTaskClient](_actionstaskclient_.actionstaskclient.md)

# Class: ActionsTaskClient

## Hierarchy

* **ActionsTaskClient**

## Index

### Constructors

* [constructor](_actionstaskclient_.actionstaskclient.md#private-constructor)

### Properties

* [context](_actionstaskclient_.actionstaskclient.md#context)
* [currentPage](_actionstaskclient_.actionstaskclient.md#currentpage)
* [events](_actionstaskclient_.actionstaskclient.md#private-events)
* [numPages](_actionstaskclient_.actionstaskclient.md#numpages)
* [pluginClientInstance](_actionstaskclient_.actionstaskclient.md#pluginclientinstance)

### Methods

* [customOnSave](_actionstaskclient_.actionstaskclient.md#customonsave)
* [disableAdvance](_actionstaskclient_.actionstaskclient.md#disableadvance)
* [disableBackButton](_actionstaskclient_.actionstaskclient.md#disablebackbutton)
* [disableSaveButton](_actionstaskclient_.actionstaskclient.md#disablesavebutton)
* [enableAdvance](_actionstaskclient_.actionstaskclient.md#enableadvance)
* [enableBackButton](_actionstaskclient_.actionstaskclient.md#enablebackbutton)
* [enableSaveButton](_actionstaskclient_.actionstaskclient.md#enablesavebutton)
* [fetch](_actionstaskclient_.actionstaskclient.md#fetch)
* [getAvailableConnections](_actionstaskclient_.actionstaskclient.md#getavailableconnections)
* [getAvailableDataSources](_actionstaskclient_.actionstaskclient.md#getavailabledatasources)
* [getAvailableFileDescriptors](_actionstaskclient_.actionstaskclient.md#getavailablefiledescriptors)
* [getAvailableMediaSources](_actionstaskclient_.actionstaskclient.md#getavailablemediasources)
* [getConfig](_actionstaskclient_.actionstaskclient.md#getconfig)
* [getLanguage](_actionstaskclient_.actionstaskclient.md#getlanguage)
* [getPipedText](_actionstaskclient_.actionstaskclient.md#getpipedtext)
* [getPluginConfig](_actionstaskclient_.actionstaskclient.md#getpluginconfig)
* [getText](_actionstaskclient_.actionstaskclient.md#gettext)
* [isNewTask](_actionstaskclient_.actionstaskclient.md#isnewtask)
* [isSavedTask](_actionstaskclient_.actionstaskclient.md#issavedtask)
* [onBack](_actionstaskclient_.actionstaskclient.md#onback)
* [onNext](_actionstaskclient_.actionstaskclient.md#onnext)
* [onSave](_actionstaskclient_.actionstaskclient.md#onsave)
* [qualtricsApiFetch](_actionstaskclient_.actionstaskclient.md#qualtricsapifetch)
* [webServiceOnSave](_actionstaskclient_.actionstaskclient.md#webserviceonsave)
* [xmFunctionOnSave](_actionstaskclient_.actionstaskclient.md#xmfunctiononsave)
* [initialize](_actionstaskclient_.actionstaskclient.md#static-initialize)

## Constructors

### `Private` constructor

\+ **new ActionsTaskClient**(`pluginClientInstance`: PluginClient, `events`: [ActionTaskEvents](../modules/_models_models_.md#actiontaskevents), `numPages`: number): *[ActionsTaskClient](_actionstaskclient_.actionstaskclient.md)*

Defined in actionsTaskClient.ts:44

**Parameters:**

Name | Type |
------ | ------ |
`pluginClientInstance` | PluginClient |
`events` | [ActionTaskEvents](../modules/_models_models_.md#actiontaskevents) |
`numPages` | number |

**Returns:** *[ActionsTaskClient](_actionstaskclient_.actionstaskclient.md)*

## Properties

###  context

• **context**: *[Context](../modules/_models_models_.md#context)*

Defined in actionsTaskClient.ts:43

___

###  currentPage

• **currentPage**: *number*

Defined in actionsTaskClient.ts:44

___

### `Private` events

• **events**: *[ActionTaskEvents](../modules/_models_models_.md#actiontaskevents)*

Defined in actionsTaskClient.ts:48

___

###  numPages

• **numPages**: *number*

Defined in actionsTaskClient.ts:49

___

###  pluginClientInstance

• **pluginClientInstance**: *PluginClient*

Defined in actionsTaskClient.ts:47

## Methods

###  customOnSave

▸ **customOnSave**(`saveHandler`: function): *void*

Defined in actionsTaskClient.ts:435

Used when wanting to make the task trigger a custom worker.

The handler should return a config with a custom triggerAction
```
{
  triggerAction {string}: custom worker name
  ...
  any other fields to pass to the custom worker
}
```

**Parameters:**

▪ **saveHandler**: *function*

▸ (...`args`: unknown[]): *unknown*

**Parameters:**

Name | Type |
------ | ------ |
`...args` | unknown[] |

**Returns:** *void*

___

###  disableAdvance

▸ **disableAdvance**(): *void*

Defined in actionsTaskClient.ts:135

**Returns:** *void*

___

###  disableBackButton

▸ **disableBackButton**(): *void*

Defined in actionsTaskClient.ts:163

Disables the back button

**Returns:** *void*

___

###  disableSaveButton

▸ **disableSaveButton**(): *void*

Defined in actionsTaskClient.ts:149

Disables the save button so the task cannot be saved

**Returns:** *void*

___

###  enableAdvance

▸ **enableAdvance**(): *void*

Defined in actionsTaskClient.ts:131

**Returns:** *void*

___

###  enableBackButton

▸ **enableBackButton**(): *void*

Defined in actionsTaskClient.ts:156

Enables the back button

**Returns:** *void*

___

###  enableSaveButton

▸ **enableSaveButton**(): *void*

Defined in actionsTaskClient.ts:142

Enables the save button so the task can be saved

**Returns:** *void*

___

###  fetch

▸ **fetch**(`url`: string, `fetchConfig`: UserProvidedFetchConfig, `timeout`: number): *Promise‹FetchResponse›*

Defined in actionsTaskClient.ts:586

Sends a request to the provided URL. Injects user defined account for authentication
if specified in connection property.

fetchConfig should be formatted as follows:
```
{
  method {string}: the http method to use (ex: 'POST', 'GET, 'PUT', etc.)
  headers {object} (optional): key/value pairs that correspond to headers to add to the request (ex: "Content-Type": "application/json")
  body {object | string} (optional): the body of the request
  params {object} (optional): key/value pairs that correspond query params to add to the request URL (ex: "filter": "random")
  connection {object} (optional): {
    connectionName {string}: the name of the connection to use (see context.availableConnections for a list of connections).
    paramFormat {string}: where to place the credential. Can be 'header','body', or 'query'.
    paramName {string}: what to name the credential param. As in, the field name for a body param, the query name for a query param, or the header name for a header. Ex: for a bearer token this might be "Authorization".
    paramTemplate {string}: what to insert the credential as. Use it similarly to a string passed to String.format. EX: "Bearer %s" would be a template for bearer tokens, "%s" inserts the token as-is.
  }
}
```

**Parameters:**

Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`url` | string | - | The URL to make a request to |
`fetchConfig` | UserProvidedFetchConfig | - | Configures all aspects of the request |
`timeout` | number | LONG_TIMEOUT | Defaults to 10000 (10 seconds). Specifies the number of milliseconds at which to reject the returned promise if no response has been received from the Plugin. |

**Returns:** *Promise‹FetchResponse›*

resolves to an object containing {responseBody: JSON string, httpStatusCode: string}

___

###  getAvailableConnections

▸ **getAvailableConnections**(): *any*

Defined in actionsTaskClient.ts:188

Used to get an object of possible connections

**Returns:** *any*

returns an object of available connections and their ID's

___

###  getAvailableDataSources

▸ **getAvailableDataSources**(): *[Source](../interfaces/_models_models_.source.md)[]*

Defined in actionsTaskClient.ts:200

Used to get an array of Source objects of available data sources

**Returns:** *[Source](../interfaces/_models_models_.source.md)[]*

returns an array of objects of available data sources

___

###  getAvailableFileDescriptors

▸ **getAvailableFileDescriptors**(): *[AvailableFileDescriptor](../interfaces/_models_models_.availablefiledescriptor.md)[]*

Defined in actionsTaskClient.ts:221

Used to get an array of AvailableFileDescriptor objects of available file descriptors

**Returns:** *[AvailableFileDescriptor](../interfaces/_models_models_.availablefiledescriptor.md)[]*

returns an array of available AvailableFileDescriptor objects

___

###  getAvailableMediaSources

▸ **getAvailableMediaSources**(): *[WorkflowMediaSource](../interfaces/_models_models_.workflowmediasource.md)[]*

Defined in actionsTaskClient.ts:212

Use to get an array of WorkflowMediaSource objects of available media sources

**Returns:** *[WorkflowMediaSource](../interfaces/_models_models_.workflowmediasource.md)[]*

returns an array of objects of available media sources

___

###  getConfig

▸ **getConfig**(): *unknown*

Defined in actionsTaskClient.ts:278

Used to get the previously saved config.

**Returns:** *unknown*

Returns the previously saved config, or an empty object if it is a new task

___

###  getLanguage

▸ **getLanguage**(): *string*

Defined in actionsTaskClient.ts:535

Returns the language code of the logged in user given by the host on init.

**Returns:** *string*

the language code of the logged user given by the host on init.

___

###  getPipedText

▸ **getPipedText**(): *any[]*

Defined in actionsTaskClient.ts:230

Used to retrieve the piped text to be used in components from the `@qualtrics/plugin-ui-react` library

**Returns:** *any[]*

Returns piped text array

___

###  getPluginConfig

▸ **getPluginConfig**(`key`: string): *Promise‹string | number | false | true | object | unknown[]›*

Defined in actionsTaskClient.ts:270

Returns a value from the plugin's configuration.

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`key` | string | The key of the value in the configuration, defined in the extension's manifest. |

**Returns:** *Promise‹string | number | false | true | object | unknown[]›*

A promise that resolves to the value of the key in the configuration.

___

###  getText

▸ **getText**(`key`: string, `placeHolders?`: Record‹string, string›, `defaultVal?`: undefined | string): *string*

Defined in actionsTaskClient.ts:523

Retrieves localized strings from the Plugin's translation files, specifically
from the translation that matches the User's language. Valid keys are defined by top-level
properties of the `strings` object in the translation file.

**Parameters:**

Name | Type |
------ | ------ |
`key` | string |
`placeHolders?` | Record‹string, string› |
`defaultVal?` | undefined &#124; string |

**Returns:** *string*

the translation associated with the key

___

###  isNewTask

▸ **isNewTask**(): *boolean*

Defined in actionsTaskClient.ts:171

Used to determine if the user is configuring a new task

**Returns:** *boolean*

Returns true if the task is new. Returns false if it is a saved task.

___

###  isSavedTask

▸ **isSavedTask**(): *boolean*

Defined in actionsTaskClient.ts:179

Used to determine if the user is edditing a saved task

**Returns:** *boolean*

Returns false if the task is new. Returns true if it is a saved task.

___

###  onBack

▸ **onBack**(`callback`: function): *void*

Defined in actionsTaskClient.ts:492

The back handler will be called when the back button is pressed.

**Parameters:**

▪ **callback**: *function*

A callback function that will be called with the back page number.

▸ (...`args`: unknown[]): *unknown*

**Parameters:**

Name | Type |
------ | ------ |
`...args` | unknown[] |

**Returns:** *void*

___

###  onNext

▸ **onNext**(`callback`: function, `isValid`: boolean): *void*

Defined in actionsTaskClient.ts:462

The next handler will be called when the next button is pressed.

**Parameters:**

▪ **callback**: *function*

A callback function that will be called with the next page number. If isValid is false, the callback will be called with the current page number instead.

▸ (...`args`: unknown[]): *unknown*

**Parameters:**

Name | Type |
------ | ------ |
`...args` | unknown[] |

▪`Default value`  **isValid**: *boolean*= true

A boolean value that indicates whether the current page is valid.

**Returns:** *void*

___

###  onSave

▸ **onSave**(`saveHandler`: function): *void*

Defined in actionsTaskClient.ts:300

The save handler will be called when the save button is pressed. Currently defaults to a WebService task. It should return a
config that is formatted as follows:
```
{
  url {string}: the url of the http request
  method {string}: POST or PUT
  headers {object}: the header of the http request
  body {object}: The body of the http request
  connection {object}: {
    id {string}: the name of the connection to use (see getAvailableConnections() for a list of ID's).
    paramFormat {string}: where to place the credential. Can be 'header','body', or 'query'.
    paramName {string}: what to name the credential param. As in, the field name for a body param, the query name for a query param, or the header name for a header. Ex: for a bearer token this might be "Authorization".
    paramTemplate {string}: what to insert the credential as. Use it similarly to a string passed to String.format. EX: "Bearer %s" would be a template for bearer tokens, "%s" inserts the token as-is.
}
```

**Parameters:**

▪ **saveHandler**: *function*

▸ (...`args`: unknown[]): *unknown*

**Parameters:**

Name | Type |
------ | ------ |
`...args` | unknown[] |

**Returns:** *void*

___

###  qualtricsApiFetch

▸ **qualtricsApiFetch**(`url`: string, `config`: UserProvidedQualtricsApiFetchConfig, `timeout`: number): *Promise‹FetchResponse›*

Defined in actionsTaskClient.ts:554

Make a request to Qualtrics Public API. Similar to fetch, but doesn't accept a connection.

The config should be formatted as follows:
```
{
  method {string}: the http method to use (ex: 'POST', 'GET, 'PUT', etc.)
  body {object | string} (optional): the body of the request
}
```

**Parameters:**

Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`url` | string | - | The relative Qualtrics API path to make a request to, such as `surveys` |
`config` | UserProvidedQualtricsApiFetchConfig | - | Configures all aspects of the request |
`timeout` | number | LONG_TIMEOUT | Defaults to 10000 (10 seconds). Specifies the number of milliseconds at which to reject the returned promise if no response has been received from the Plugin. |

**Returns:** *Promise‹FetchResponse›*

- response from the API

___

###  webServiceOnSave

▸ **webServiceOnSave**(`saveHandler`: function): *void*

Defined in actionsTaskClient.ts:322

The save handler will be called when the save button is pressed in order to use a WebService task. It should return a
config that is formatted as follows:
```
{
  url {string}: the url of the http request
  method {string}: POST or PUT
  headers {object}: the header of the http request
  body {object}: The body of the http request
  connection {object}: {
    id {string}: the name of the connection to use (see getAvailableConnections() for a list of ID's).
    paramFormat {string}: where to place the credential. Can be 'header','body', or 'query'.
    paramName {string}: what to name the credential param. As in, the field name for a body param, the query name for a query param, or the header name for a header. Ex: for a bearer token this might be "Authorization".
    paramTemplate {string}: what to insert the credential as. Use it similarly to a string passed to String.format. EX: "Bearer %s" would be a template for bearer tokens, "%s" inserts the token as-is.
}
```

**Parameters:**

▪ **saveHandler**: *function*

▸ (...`args`: unknown[]): *unknown*

**Parameters:**

Name | Type |
------ | ------ |
`...args` | unknown[] |

**Returns:** *void*

___

###  xmFunctionOnSave

▸ **xmFunctionOnSave**(`saveHandler`: function): *void*

Defined in actionsTaskClient.ts:386

The save handler will be called when the save button is pressed in order to use an XM Function task. It should return a
config that is formatted as follows:
```
{
  arguments {object}: the arguments passed into XM Function in worker.js. Maps argument names to argument values.
  exports {ExportItem[]}: [
    {
      key {string}: the key of the export item
      display_name{string}: the display name of the export item
    }
  ]
}
```

**Parameters:**

▪ **saveHandler**: *function*

▸ (...`args`: unknown[]): *unknown*

**Parameters:**

Name | Type |
------ | ------ |
`...args` | unknown[] |

**Returns:** *void*

___

### `Static` initialize

▸ **initialize**(`options?`: [ActionTaskOptions](../modules/_models_models_.md#actiontaskoptions)): *Promise‹[ActionsTaskClient](_actionstaskclient_.actionstaskclient.md)›*

Defined in actionsTaskClient.ts:108

**Parameters:**

Name | Type |
------ | ------ |
`options?` | [ActionTaskOptions](../modules/_models_models_.md#actiontaskoptions) |

**Returns:** *Promise‹[ActionsTaskClient](_actionstaskclient_.actionstaskclient.md)›*
