# Class: GroupClient

## GroupClient

## Constructor

#### new GroupClient(jiraClient)

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

These are considered experimental according to the Jira Docs, use at your own risk.

##### Parameters:

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

Source:
  - api/group.js, line 5

### Methods

#### addUserToGroup(opts, callback)

Adds given user to a group. Returns the current state of the group.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`groupName` | string | A name of requested group.
`userName` | string | The name of the user to add to the group.
`callback` |  | Called when the user has been added to the group.

Source:
  - api/group.js, line 73

#### createGroup(opts, callback)

Creates a group by given group parameter Returns REST representation for the requested group.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to jira ###### Properties
Name | Type | Description
--- | --- | ---
`group` |  | The group to create. See https://docs.atlassian.com/jira/REST/latest/#d2e2011
`callback` |  | Called when the group is created

Source:
  - api/group.js, line 16

#### deleteGroup(opts, callback)

Deletes a group by given group parameter. Returns no content

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Attributes | Description
--- | --- | --- | ---
`groupName` | string |  | A group to delete.
`swapGroup` | string | <optional> | A group to transfer visibility restrictions of the group that is being deleted
`callback` |  | Called when the group has been deleted.

Source:
  - api/group.js, line 125

#### getGroup(opts, callback)

Returns REST representation for the requested group. Allows to get list of active users belonging to the specified group and its subgroups if "users" expand option is provided. You can page through users list by using indexes in expand param. For example to get users from index 10 to index 15 use "users[10:15]" expand value. This will return 6 users (if there are at least 16 users in this group). Indexes are 0-based and inclusive.

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` |  | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`groupName` |  | A name of requested group.
`expand` |  | Array of fields to expand. Currently only available expand is "users".
`callback` |  | Called when the group is retrieved.

Source:
  - api/group.js, line 37

#### removeUserFromGroup(opts, callback)

Removes given user from a group. Returns no content

##### Parameters:

Name | Type | Description
--- | --- | ---
`opts` | Object | The request options sent to the Jira API ###### Properties
Name | Type | Description
--- | --- | ---
`groupName` | string | A name of requested group.
`userName` | string | The name of the user to add to the group.
`callback` |  | Called when the user has been added to the group.

Source:
  - api/group.js, line 100