# Class: VersionClient

## VersionClient

## Constructor

#### new VersionClient(jiraClient)

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

##### Parameters:

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

Source:
  - api/version.js, line 5

### Methods

#### createRemoteLink(opts, callback)

Create a remote version link via POST. The link's global id will be taken from the JSON payload if provided; otherwise, it will be generated.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` |  | The version for which to retrieve unresolved issues.
`remoteLink` |  | See https://docs.atlassian.com/jira/REST/latest/#d2e3753
`callback` |  | Called when the remote link has been created.

Source:
  - api/version.js, line 124

#### createVersion(opts, callback)

Creates a version

##### Parameters:

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

Source:
  - api/version.js, line 13

#### createVersion(opts, callback)

Modify an existing version; any omitted fields will be ignored.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to Jira. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` | string | The id of the version to edit.
`version` | Object | See https://docs.atlassian.com/jira/REST/latest/#d2e3619
`callback` |  | Called when the version has been modified.

Source:
  - api/version.js, line 67

#### deleteAllRemoteLinks(opts, callback)

Delete all remote version links for a given version id.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` | string | number | The id of the version to delete.
`callback` |  | Called when the version is deleted.

Source:
  - api/version.js, line 184

#### deleteRemoteLink(opts, callback)

Delete a remote version link.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` |  | The version id
`remoteLinkId` |  | The global id of the remote link
`callback` |  | Called when the link has been deleted.

Source:
  - api/version.js, line 155

#### deleteVersion(opts, callback)

Delete a project version.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` | string | number | The id of the version to delete.
`callback` |  | Called when the version is deleted.

Source:
  - api/version.js, line 170

#### getGlobalRemoteLink(opts, callback)

Returns the remote version links for a given global id.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`globalId` |  | The global id of the remote resource that is linked to the versions
`callback` |  | Called when the remote link is returned.

Source:
  - api/version.js, line 198

#### getRelatedIssueCounts(opts, callback)

Get a bean containing the number of fixed in and affected issues for the given version.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` |  | The version for which to retrieve related issues.
`callback` |  | Called when the count has been retrieved.

Source:
  - api/version.js, line 82

#### getRemoteLinks(opts, callback)

Get the remote version links associated with the given version id.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` |  | The version for which to retrieve remote links.
`callback` |  | Called when the links have been retrieved.

Source:
  - api/version.js, line 110

#### getRemoteLinks(opts, callback)

Get a REST sub-resource representing a remote version link.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` |  | The version for which to retrieve the remote link
`remoteLinkId` |  | The global id of the remote link
`callback` |  | Called when the link has been retrieved.

Source:
  - api/version.js, line 140

#### getUnresolvedIssueCount(opts, callback)

Get the number of unresolved issues for the given version

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` |  | The version for which to retrieve unresolved issues.
`callback` |  | Called when the count has been retrieved.

Source:
  - api/version.js, line 96

#### getVersion(opts, callback)

Get a project version.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API. ###### Properties
Name | Type | Description
--- | --- | ---
`versionId` | string | number | The id of the version to retrieve.
`callback` |  | Called when the version is retrieved.

Source:
  - api/version.js, line 53

#### moveVersion(opts, callback)

Modify a version's sequence within a project. The move version bean has 2 alternative field value pairs (opts.position or opts.after). One and only one of these two must be provided.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API. ###### Properties
Name | Type | Attributes | Description
--- | --- | --- | ---
`versionId` | string |  | The id of the version to move.
`position` | string | <optional> | An absolute position, which may have a value of 'First', 'Last', 'Earlier' or 'Later'. Must be provided if opts.after is missing.
`after` | string | <optional> | A version to place this version after. The value should be the self link of another version. Must be provided if opts.position is missing
`callback` |  | Called when the version has been moved.

Source:
  - api/version.js, line 34