# Class: WorkflowSchemeClient

## WorkflowSchemeClient

## Constructor

#### new WorkflowSchemeClient(jiraClient)

Used to access Jira REST endpoints in '/rest/api/2/workflowscheme'

##### Parameters:

Name | Type | Description
--- | --- | ---
`jiraClient` | JiraClient |

Source:
  - api/workflowScheme.js, line 5

### Methods

#### createDraft(opts, callback)

Create a draft for the passed scheme. The draft will be a copy of the state of the parent.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`callback` |  | Called when the draft has been created.

Source:
  - api/workflowScheme.js, line 83

#### createWorkflowScheme(opts, callback)

Create a new workflow scheme. The body contains a representation of the new scheme. Values not passed are assumed to be set to their defaults.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowScheme` |  | See https://docs.atlassian.com/jira/REST/latest/#d2e2196
`callback` |  | Called when the workflow scheme has been created.

Source:
  - api/workflowScheme.js, line 13

#### deleteDraft(opts, callback)

Delete the passed draft workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`callback` |  | Called when the draft has been deleted.

Source:
  - api/workflowScheme.js, line 179

#### deleteDraftWorkflow(opts, callback)

Delete the passed workflow from the workflow draft scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` | number | The id of the workflow scheme.
`workflowName` | string | The name of the workflow.
`callback` |  | Called when the workflow has been edited.

Source:
  - api/workflowScheme.js, line 433

#### deleteWorkflow(opts, callback)

Delete the passed workflow from the workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` | number | The id of the workflow scheme.
`workflowName` | string | The name of the workflow.
`callback` |  | Called when the workflow has been edited.

Source:
  - api/workflowScheme.js, line 418

#### deleteWorkflowScheme(opts, callback)

Delete the passed workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`callback` |  | Called when the workflow scheme has been deleted.

Source:
  - api/workflowScheme.js, line 69

#### editDraft(opts, callback)

Update a draft workflow scheme. The draft will created if necessary. The body is a representation of the workflow scheme. Values not passed are assumed to indicate no change for that field.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`draft` |  | See https://docs.atlassian.com/jira/REST/latest/#d2e2575
`callback` |  | Called when the draft has been edited.

Source:
  - api/workflowScheme.js, line 163

#### editDraftIssueType(opts, callback)

Set the issue type mapping for the passed draft scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`issueType` |  | The issue type
`workflow` |  | The new workflow
`callback` |  | Called when the issue type has been edited

Source:
  - api/workflowScheme.js, line 311

#### editDraftWorkflow(opts, callback)

Update the draft scheme to include the passed mapping. The body is a representation of the workflow mapping. Values not passed are assumed to indicate no change for that field.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` | number | The id of the workflow scheme.
`workflowName` | string | The name of the workflow.
`issueTypes` | Array | The new issue types to inclue in the workflow. See https://docs.atlassian.com/jira/REST/latest/#d2e2670
`callback` |  | Called when the workflow has been edited.

Source:
  - api/workflowScheme.js, line 397

#### editIssueType(opts, callback)

Set the issue type mapping for the passed scheme. The passed representation can have its updateDraftIfNeeded flag set to true to indicate that the draft should be created/updated when the actual scheme cannot be edited.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`issueType` |  | The issue type
`workflow` |  | The new workflow
`updateDraftIfNeeded` |  | when true will create and return a draft when the workflow scheme cannot be edited (e.g. when it is being used by a project).
`callback` |  | Called when the issue type has been edited

Source:
  - api/workflowScheme.js, line 257

#### editWorkflow(opts, callback)

Update the scheme to include the passed mapping. The body is a representation of the workflow mapping. Values not passed are assumed to indicate no change for that field.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` | number | The id of the workflow scheme.
`workflowName` | string | The name of the workflow.
`issueTypes` | Array | The new issue types to inclue in the workflow. See https://docs.atlassian.com/jira/REST/latest/#d2e2509
`callback` |  | Called when the workflow has been edited.

Source:
  - api/workflowScheme.js, line 376

#### editWorkflowScheme(opts, callback)

Update the passed workflow scheme. The body of the request is a representation of the workflow scheme. Values not passed are assumed to indicate no change for that field. The passed representation can have its updateDraftIfNeeded flag set to true to indicate that the draft should be created and/or updated when the actual scheme cannot be edited (e.g. when the scheme is being used by a project). Values not appearing the body will not be touched.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`workflowScheme` |  | See https://docs.atlassian.com/jira/REST/latest/#d2e2305
`callback` |  | Called when the workflow scheme has been edited.

Source:
  - api/workflowScheme.js, line 34

#### getDefaultWorkflow(opts, callback)

Get the default workflow from the passed workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`returnDraftIfExists` |  | when true indicates that a scheme's draft, if it exists, should be queried instead of the scheme itself.
`callback` |  | Called when the default workflow is returned.

Source:
  - api/workflowScheme.js, line 97

#### getDraft(opts, callback)

Get the requested draft workflow scheme

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`callback` |  | Called when the draft has been retrieved.

Source:
  - api/workflowScheme.js, line 149

#### getDraftDefaultWorkflow(opts, callback)

Get the default workflow from the passed draft workflow scheme

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`callback` |  | Called when the default workflow is returned.

Source:
  - api/workflowScheme.js, line 193

#### getDraftIssueType(opts, callback)

Returns the issue type mapping for the passed draft workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`issueType` |  | The issue type
`callback` |  | Called when the issue type has been retrieved.

Source:
  - api/workflowScheme.js, line 296

#### getDraftWorkflow(opts, callback)

Returns the workflow mappings or requested mapping to the caller for the passed draft scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`workflowName` |  | The name of the workflow.
`callback` |  | Called when the workflow has been retrieved.

Source:
  - api/workflowScheme.js, line 359

#### getIssueType(opts, callback)

Returns the issue type mapping for the passed workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`issueType` |  | The issue type
`returnDraftIfExists` |  | when true indicates that a scheme's draft, if it exists, should be queried instead of the scheme itself.
`callback` |  | Called when the issue type has been retrieved.

Source:
  - api/workflowScheme.js, line 239

#### getWorkflow(opts, callback)

Returns the workflow mappings or requested mapping to the caller for the passed scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`workflowName` |  | The name of the workflow.
`callback` |  | Called when the workflow has been retrieved.

Source:
  - api/workflowScheme.js, line 342

#### getWorkflowScheme(opts, callback)

Get the requested workflow scheme

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`workflowSchemeId` |  |  |  | The id of the workflow scheme.
`returnDraftIfExists` |  | <optional> | false | when true indicates that a scheme's draft, if it exists, should be queried instead of the scheme itself.
`callback` |  | Called when the workflow scheme has been retrieved.

Source:
  - api/workflowScheme.js, line 53

#### removeDefaultWorkflow(opts, callback)

Remove the default workflow from the passed workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`updateDraftIfNeeded` |  | when true will create and return a draft when the workflow scheme cannot be edited (e.g. when it is being used by a project).
`callback` |  | Called when the defaul workflow has been removed.

Source:
  - api/workflowScheme.js, line 113

#### removeDraftDefaultWorkflow(opts, callback)

Remove the default workflow from the passed draft workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`callback` |  | Called when the defaul workflow has been removed.

Source:
  - api/workflowScheme.js, line 225

#### removeDraftIssueType(opts, callback)

Remove the specified issue type mapping from the scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`issueType` |  | The issue type
`callback` |  | Called when the issue type mapping has been removed.

Source:
  - api/workflowScheme.js, line 327

#### removeIssueType(opts, callback)

Remove the specified issue type mapping from the scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`issueType` |  | The issue type
`callback` |  | Called when the issue type mapping has been removed.

Source:
  - api/workflowScheme.js, line 279

#### setDefaultWorkflow(opts, callback)

Remove the default workflow from the passed workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`workflowName` |  | The name of the new deafault workflow
`updateDraftIfNeeded` |  | when true will create and return a draft when the workflow scheme cannot be edited (e.g. when it is being used by a project).
`callback` |  | Called when the default workflow has been updated.

Source:
  - api/workflowScheme.js, line 129

#### setDraftDefaultWorkflow(opts, callback)

Remove the default workflow from the passed workflow scheme.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`workflowSchemeId` |  | The id of the workflow scheme.
`workflowName` |  | The name of the new default workflow
`callback` |  | Called when the default workflow has been updated.

Source:
  - api/workflowScheme.js, line 207