## Classes

<dl>
<dt><a href="#LaunchDarklyApiClient">LaunchDarklyApiClient</a></dt>
<dd></dd>
<dt><a href="#LaunchDarklyLogger">LaunchDarklyLogger</a></dt>
<dd></dd>
<dt><a href="#LaunchDarklyUtils">LaunchDarklyUtils</a></dt>
<dd></dd>
<dt><a href="#LaunchDarklyUtilsFlags">LaunchDarklyUtilsFlags</a></dt>
<dd></dd>
<dt><a href="#LaunchDarklyUtilsMembers">LaunchDarklyUtilsMembers</a></dt>
<dd></dd>
<dt><a href="#LaunchDarklyUtilsProjects">LaunchDarklyUtilsProjects</a></dt>
<dd></dd>
<dt><a href="#LaunchDarklyUtilsRoles">LaunchDarklyUtilsRoles</a></dt>
<dd></dd>
</dl>

<a name="LaunchDarklyApiClient"></a>

## LaunchDarklyApiClient
**Kind**: global class  
<a name="LaunchDarklyApiClient.create"></a>

### LaunchDarklyApiClient.create(API_TOKEN, log, swaggerYamlString) ⇒ <code>Promise</code>
Used internally by LaunchDarklyUtils to create an instance of
Swagger apiClient with interceptors configured

**Kind**: static method of [<code>LaunchDarklyApiClient</code>](#LaunchDarklyApiClient)  
**Fulfil**: <code>Swagger</code> apiClient generated by swagger-js  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| API_TOKEN | <code>string</code> | from LaunchDarkly dashboard |
| log | <code>Object</code> | logger implementation |
| swaggerYamlString | <code>string</code> | optional serialized yaml |

<a name="LaunchDarklyLogger"></a>

## LaunchDarklyLogger
**Kind**: global class  
<a name="LaunchDarklyLogger.logger"></a>

### LaunchDarklyLogger.logger() ⇒ <code>Logger</code>
Get handle on Bunyan logger.  This is the default logger if not supplied to utils.

**Kind**: static method of [<code>LaunchDarklyLogger</code>](#LaunchDarklyLogger)  
<a name="LaunchDarklyUtils"></a>

## LaunchDarklyUtils
**Kind**: global class  
<a name="LaunchDarklyUtils+create"></a>

### launchDarklyUtils.create(API_TOKEN, customLogger, swaggerYamlString) ⇒ <code>Promise</code>
Create an instance of ldutils with api specific classes attached. This is the primary class used to access apis,
as api grouping util classes are attached to this class.

**Kind**: instance method of [<code>LaunchDarklyUtils</code>](#LaunchDarklyUtils)  
**Fulfil**: [<code>LaunchDarklyUtils</code>](#LaunchDarklyUtils)  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| API_TOKEN | <code>string</code> | from LaunchDarkly dashboard |
| customLogger | <code>Object</code> | logger implementation, or 'console'. If not supplied, defaults to Bunyan logger |
| swaggerYamlString | <code>string</code> | optional serialized yaml |

<a name="LaunchDarklyUtilsFlags"></a>

## LaunchDarklyUtilsFlags
**Kind**: global class  

* [LaunchDarklyUtilsFlags](#LaunchDarklyUtilsFlags)
    * [new LaunchDarklyUtilsFlags(apiClient, log, ldUtils)](#new_LaunchDarklyUtilsFlags_new)
    * [.API_GROUP](#LaunchDarklyUtilsFlags+API_GROUP) ⇒ <code>string</code>
    * [.getFeatureFlags(projectKey)](#LaunchDarklyUtilsFlags+getFeatureFlags) ⇒ <code>Promise</code>
    * [.getFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery)](#LaunchDarklyUtilsFlags+getFeatureFlag) ⇒ <code>Promise</code>
    * [.getFeatureFlagState(projectKey, featureFlagKey, environmentKeyQuery)](#LaunchDarklyUtilsFlags+getFeatureFlagState) ⇒ <code>Promise</code>
    * [.updateFeatureFlag(projectKey, featureFlagKey, patchComment)](#LaunchDarklyUtilsFlags+updateFeatureFlag) ⇒ <code>Promise</code>
    * [.toggleFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery, value)](#LaunchDarklyUtilsFlags+toggleFeatureFlag) ⇒ <code>Promise</code>
    * [.migrateFeatureFlag(projectKey, featureFlagKey, fromEnv, toEnv, includeState)](#LaunchDarklyUtilsFlags+migrateFeatureFlag) ⇒ <code>Promise</code>
    * [.bulkMigrateFeatureFlags(projectKey, featureFlagKeys, fromEnv, toEnv, includeState)](#LaunchDarklyUtilsFlags+bulkMigrateFeatureFlags) ⇒ <code>Promise</code>
    * [.restoreFeatureFlags(projectKey, featureFlagKeys, targetEnv, backupJsonFile, includeState)](#LaunchDarklyUtilsFlags+restoreFeatureFlags) ⇒ <code>Promise</code>

<a name="new_LaunchDarklyUtilsFlags_new"></a>

### new LaunchDarklyUtilsFlags(apiClient, log, ldUtils)
Feature flag specific api functions attached as 'LaunchDarklyUtils.flags'

**Returns**: [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags) - feature flag api functions  

| Param | Type | Description |
| --- | --- | --- |
| apiClient | <code>Swagger</code> | generated launchdarkly apiClient |
| log | <code>Object</code> | logger implementation, or 'console' |
| ldUtils | [<code>LaunchDarklyUtils</code>](#LaunchDarklyUtils) | primary utils class |

<a name="LaunchDarklyUtilsFlags+API_GROUP"></a>

### launchDarklyUtilsFlags.API\_GROUP ⇒ <code>string</code>
Api group object key in LD api

**Kind**: instance property of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
<a name="LaunchDarklyUtilsFlags+getFeatureFlags"></a>

### launchDarklyUtilsFlags.getFeatureFlags(projectKey) ⇒ <code>Promise</code>
Get all feature flags in project

**Kind**: instance method of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
**Fulfil**: <code>Object</code> feature flag list json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>string</code> | project identifier |

**Example**  
```js
ldutils getFeatureFlags my-project
```
<a name="LaunchDarklyUtilsFlags+getFeatureFlag"></a>

### launchDarklyUtilsFlags.getFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery) ⇒ <code>Promise</code>
Get a single feature flag by key, and optional environment

**Kind**: instance method of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
**Fulfil**: <code>Object</code> feature flag json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>string</code> | project identifier |
| featureFlagKey | <code>string</code> | feature flag identifier |
| environmentKeyQuery | <code>string</code> | optional environment name |

**Example**  
```js
ldutils getFeatureFlag my-project my-flag dev
```
<a name="LaunchDarklyUtilsFlags+getFeatureFlagState"></a>

### launchDarklyUtilsFlags.getFeatureFlagState(projectKey, featureFlagKey, environmentKeyQuery) ⇒ <code>Promise</code>
Get the boolean state of a single feature flag by key, and optional environment

**Kind**: instance method of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
**Fulfil**: <code>boolean</code> true/false  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>string</code> | project identifier |
| featureFlagKey | <code>string</code> | feature flag identifier |
| environmentKeyQuery | <code>string</code> | environment name |

**Example**  
```js
ldutils getFeatureFlagState my-project my-flag dev
```
<a name="LaunchDarklyUtilsFlags+updateFeatureFlag"></a>

### launchDarklyUtilsFlags.updateFeatureFlag(projectKey, featureFlagKey, patchComment) ⇒ <code>Promise</code>
patch a feature flag by key

**Kind**: instance method of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
**Fulfil**: <code>Object</code> updated feature flag json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>string</code> | project identifier |
| featureFlagKey | <code>string</code> | feature flag identifier |
| patchComment | <code>Array.&lt;Object&gt;</code> | array of valid json patch descriptors |

**Example**  
```js
ldutils updateFeatureFlag my-project my-flag {jsonPatch}
```
<a name="LaunchDarklyUtilsFlags+toggleFeatureFlag"></a>

### launchDarklyUtilsFlags.toggleFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery, value) ⇒ <code>Promise</code>
Set the boolean state of a single feature flag by key, and environment name

**Kind**: instance method of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
**Fulfil**: <code>Object</code> updated feature flag json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>string</code> | project identifier |
| featureFlagKey | <code>string</code> | feature flag identifier |
| environmentKeyQuery | <code>string</code> | environment name |
| value | <code>boolean</code> | true or false |

**Example**  
```js
ldutils toggleFeatureFlag my-project my-flag dev true
```
<a name="LaunchDarklyUtilsFlags+migrateFeatureFlag"></a>

### launchDarklyUtilsFlags.migrateFeatureFlag(projectKey, featureFlagKey, fromEnv, toEnv, includeState) ⇒ <code>Promise</code>
Migrate feature flag properties between environments in a project. this includes:
targets, rules, fallthrough, offVariation, prerequisites and optionally the flags on/off state.

**Kind**: instance method of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
**Fulfil**: <code>Object</code> updated feature flag json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>string</code> | project identifier |
| featureFlagKey | <code>string</code> | feature flag identifier |
| fromEnv | <code>string</code> | environment to copy flag attributes from |
| toEnv | <code>string</code> | environment to copy flag attributes to |
| includeState | <code>boolean</code> | optionally copy boolean state true/false |

**Example**  
```js
ldutils migrateFeatureFlag my-project my-flag dev test
```
<a name="LaunchDarklyUtilsFlags+bulkMigrateFeatureFlags"></a>

### launchDarklyUtilsFlags.bulkMigrateFeatureFlags(projectKey, featureFlagKeys, fromEnv, toEnv, includeState) ⇒ <code>Promise</code>
Migrate multiple feature flags properties between environments in a project. this includes:
targets, rules, fallthrough, offVariation, prerequisites and optionally the flags on/off state.

**Kind**: instance method of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
**Fulfil**: <code>Object</code> updated feature flag json array  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>string</code> | project identifier |
| featureFlagKeys | <code>string</code> | comma-separated feature flag identifiers |
| fromEnv | <code>string</code> | environment to copy flag attributes from |
| toEnv | <code>string</code> | environment to copy flag attributes to |
| includeState | <code>boolean</code> | optionally copy boolean state true/false |

**Example**  
```js
ldutils bulkMigrateFeatureFlags my-project my-flag,my-flag-two dev test
```
<a name="LaunchDarklyUtilsFlags+restoreFeatureFlags"></a>

### launchDarklyUtilsFlags.restoreFeatureFlags(projectKey, featureFlagKeys, targetEnv, backupJsonFile, includeState) ⇒ <code>Promise</code>
Restore feature flags to state captured in a backup json file generated by getFeatureFlags(proj).

**Kind**: instance method of [<code>LaunchDarklyUtilsFlags</code>](#LaunchDarklyUtilsFlags)  
**Fulfil**: <code>Object</code> updated feature flag json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>string</code> | project identifier |
| featureFlagKeys | <code>string</code> | feature flag identifiers comma separated |
| targetEnv | <code>string</code> | environment to restore flag attributes to |
| backupJsonFile | <code>string</code> | file to restore from from getFeatureFlags(proj) |
| includeState | <code>boolean</code> | optionally restore boolean state true/false |

**Example**  
```js
ldutils restoreFeatureFlags my-project my-flag,my-flag-two prod ./preReleaseBackup.json true
```
<a name="LaunchDarklyUtilsMembers"></a>

## LaunchDarklyUtilsMembers
**Kind**: global class  

* [LaunchDarklyUtilsMembers](#LaunchDarklyUtilsMembers)
    * [new LaunchDarklyUtilsMembers(apiClient, log, ldUtils)](#new_LaunchDarklyUtilsMembers_new)
    * [.API_GROUP](#LaunchDarklyUtilsMembers+API_GROUP) ⇒ <code>string</code>
    * [.getTeamMembers(limit, offset, filter)](#LaunchDarklyUtilsMembers+getTeamMembers) ⇒ <code>Promise</code>
    * [.getTeamMember(memberId)](#LaunchDarklyUtilsMembers+getTeamMember) ⇒ <code>Promise</code>
    * [.getTeamMemberByEmail(emailAddress)](#LaunchDarklyUtilsMembers+getTeamMemberByEmail) ⇒ <code>Promise</code>
    * [.getTeamMemberCustomRoles(emailAddress)](#LaunchDarklyUtilsMembers+getTeamMemberCustomRoles) ⇒ <code>Promise</code>
    * [.inviteTeamMember(emailAddress, initialRoleKey)](#LaunchDarklyUtilsMembers+inviteTeamMember) ⇒ <code>Promise</code>

<a name="new_LaunchDarklyUtilsMembers_new"></a>

### new LaunchDarklyUtilsMembers(apiClient, log, ldUtils)
Team member specific api functions attached as 'LaunchDarklyUtils.members'

**Returns**: [<code>LaunchDarklyUtilsMembers</code>](#LaunchDarklyUtilsMembers) - team member api functions  

| Param | Type | Description |
| --- | --- | --- |
| apiClient | <code>Swagger</code> | generated launchdarkly apiClient |
| log | <code>Object</code> | logger implementation, or 'console' |
| ldUtils | [<code>LaunchDarklyUtils</code>](#LaunchDarklyUtils) | primary utils class |

<a name="LaunchDarklyUtilsMembers+API_GROUP"></a>

### launchDarklyUtilsMembers.API\_GROUP ⇒ <code>string</code>
Api group object key in LD api

**Kind**: instance property of [<code>LaunchDarklyUtilsMembers</code>](#LaunchDarklyUtilsMembers)  
<a name="LaunchDarklyUtilsMembers+getTeamMembers"></a>

### launchDarklyUtilsMembers.getTeamMembers(limit, offset, filter) ⇒ <code>Promise</code>
Get all team members in account

**Kind**: instance method of [<code>LaunchDarklyUtilsMembers</code>](#LaunchDarklyUtilsMembers)  
**Fulfil**: <code>Object</code> team member list json  
**Reject**: <code>Error</code> object with message  

| Param | Description |
| --- | --- |
| limit | max number of members to return (defaults to 20 per api) |
| offset | starting offset to return |
| filter | an optional filter https://apidocs.launchdarkly.com/reference#list-team-members |

**Example**  
```js
ldutils getTeamMembers
```
<a name="LaunchDarklyUtilsMembers+getTeamMember"></a>

### launchDarklyUtilsMembers.getTeamMember(memberId) ⇒ <code>Promise</code>
get a single team member by id

**Kind**: instance method of [<code>LaunchDarklyUtilsMembers</code>](#LaunchDarklyUtilsMembers)  
**Fulfil**: <code>Object</code> team member object json  
**Reject**: <code>Error</code> object with message  

| Param | Description |
| --- | --- |
| memberId | _id field of team member |

**Example**  
```js
ldutils getTeamMember 5a3ad672761af020881a8814
```
<a name="LaunchDarklyUtilsMembers+getTeamMemberByEmail"></a>

### launchDarklyUtilsMembers.getTeamMemberByEmail(emailAddress) ⇒ <code>Promise</code>
Get a team member using a supplied email address

**Kind**: instance method of [<code>LaunchDarklyUtilsMembers</code>](#LaunchDarklyUtilsMembers)  
**Fulfil**: <code>Object</code> team member json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| emailAddress | <code>string</code> | email address of member to locate |

**Example**  
```js
ldutils getTeamMemberByEmail owner-sample-account@launchdarkly.com
```
<a name="LaunchDarklyUtilsMembers+getTeamMemberCustomRoles"></a>

### launchDarklyUtilsMembers.getTeamMemberCustomRoles(emailAddress) ⇒ <code>Promise</code>
Get a team member including customRoleKeys translated from customRoles array

**Kind**: instance method of [<code>LaunchDarklyUtilsMembers</code>](#LaunchDarklyUtilsMembers)  
**Fulfil**: <code>Object</code> team member json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| emailAddress | <code>string</code> | email address of member to locate |

**Example**  
```js
ldutils getTeamMemberCustomRoles owner-sample-account@launchdarkly.com
```
<a name="LaunchDarklyUtilsMembers+inviteTeamMember"></a>

### launchDarklyUtilsMembers.inviteTeamMember(emailAddress, initialRoleKey) ⇒ <code>Promise</code>
Invite a New Team Member by their Email Address

**Kind**: instance method of [<code>LaunchDarklyUtilsMembers</code>](#LaunchDarklyUtilsMembers)  
**Fulfil**: <code>Object</code> Team Member JSON  
**Reject**: <code>Error</code> object with message  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| emailAddress | <code>String</code> |  | Email Address of New Member |
| initialRoleKey | <code>String</code> | <code>reader</code> | Default Role for New Member |

<a name="LaunchDarklyUtilsProjects"></a>

## LaunchDarklyUtilsProjects
**Kind**: global class  

* [LaunchDarklyUtilsProjects](#LaunchDarklyUtilsProjects)
    * [new LaunchDarklyUtilsProjects(apiClient, log, ldUtils)](#new_LaunchDarklyUtilsProjects_new)
    * [.API_GROUP](#LaunchDarklyUtilsProjects+API_GROUP) ⇒ <code>string</code>
    * [.getProjects()](#LaunchDarklyUtilsProjects+getProjects) ⇒ <code>Promise</code>
    * [.getProject(projectKey)](#LaunchDarklyUtilsProjects+getProject) ⇒ <code>Promise</code>
    * [.createProject(projectName, projectKey, includeInSnippetByDefault, tags, environments, defaultClientSideAvailability)](#LaunchDarklyUtilsProjects+createProject) ⇒ <code>Promise</code>
    * [.updateProject(projectKey, jsonPatch)](#LaunchDarklyUtilsProjects+updateProject) ⇒ <code>Promise</code>
    * [.deleteProject(projectKey)](#LaunchDarklyUtilsProjects+deleteProject)

<a name="new_LaunchDarklyUtilsProjects_new"></a>

### new LaunchDarklyUtilsProjects(apiClient, log, ldUtils)
Projects specific api functions attached as 'LaunchDarklyUtils.projects'

**Returns**: [<code>LaunchDarklyUtilsMembers</code>](#LaunchDarklyUtilsMembers) - team member api functions  

| Param | Type | Description |
| --- | --- | --- |
| apiClient | <code>Swagger</code> | generated launchdarkly apiClient |
| log | <code>Object</code> | logger implementation, or 'console' |
| ldUtils | [<code>LaunchDarklyUtils</code>](#LaunchDarklyUtils) | primary utils class |

<a name="LaunchDarklyUtilsProjects+API_GROUP"></a>

### launchDarklyUtilsProjects.API\_GROUP ⇒ <code>string</code>
Api group object key in LD api

**Kind**: instance property of [<code>LaunchDarklyUtilsProjects</code>](#LaunchDarklyUtilsProjects)  
<a name="LaunchDarklyUtilsProjects+getProjects"></a>

### launchDarklyUtilsProjects.getProjects() ⇒ <code>Promise</code>
Get all projects in account

**Kind**: instance method of [<code>LaunchDarklyUtilsProjects</code>](#LaunchDarklyUtilsProjects)  
**Fulfil**: <code>Object</code> List of projects JSON  
**Reject**: <code>Error</code> object with message  
**Example**  
```js
ldutils getProjects
```
<a name="LaunchDarklyUtilsProjects+getProject"></a>

### launchDarklyUtilsProjects.getProject(projectKey) ⇒ <code>Promise</code>
get a single project by project key

**Kind**: instance method of [<code>LaunchDarklyUtilsProjects</code>](#LaunchDarklyUtilsProjects)  
**Fulfil**: <code>Object</code> project object json  
**Reject**: <code>Error</code> object with message  

| Param | Description |
| --- | --- |
| projectKey | _id field of team member |

**Example**  
```js
ldutils getProject new-project
```
<a name="LaunchDarklyUtilsProjects+createProject"></a>

### launchDarklyUtilsProjects.createProject(projectName, projectKey, includeInSnippetByDefault, tags, environments, defaultClientSideAvailability) ⇒ <code>Promise</code>
Create a project in the account

**Kind**: instance method of [<code>LaunchDarklyUtilsProjects</code>](#LaunchDarklyUtilsProjects)  
**Fulfil**: <code>Object</code> project object json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectName | <code>\*</code> | the name of the project |
| projectKey | <code>\*</code> | the key that identifies the project |
| includeInSnippetByDefault | <code>\*</code> | boolean true / false of whether should include a snippet |
| tags | <code>\*</code> | arrays of tags that can be associated with the project |
| environments | <code>\*</code> | an array of environments that are associated with the account |
| defaultClientSideAvailability | <code>\*</code> | An object that defines wether the SDK and / or mobile flags are available |

**Example**  
```js
ldutils createProject new-project 'New Project' 'false' dev,Development,#41705:test,Test,f5a623 'true' 'false' marketing,online
```
<a name="LaunchDarklyUtilsProjects+updateProject"></a>

### launchDarklyUtilsProjects.updateProject(projectKey, jsonPatch) ⇒ <code>Promise</code>
Patch a single project using jsonPatch notation

**Kind**: instance method of [<code>LaunchDarklyUtilsProjects</code>](#LaunchDarklyUtilsProjects)  
**Fulfil**: <code>Object</code> an empty project  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>\*</code> | projectKey a key that identifies the project |
| jsonPatch | <code>\*</code> | an array of string using the JSON patch notation https://tools.ietf.org/html/rfc6902 |

**Example**  
```js
ldutils updateProject new-project [{ op: 'replace', path: '/name', value: 'New project name' }]
```
<a name="LaunchDarklyUtilsProjects+deleteProject"></a>

### launchDarklyUtilsProjects.deleteProject(projectKey)
Delete a project

**Kind**: instance method of [<code>LaunchDarklyUtilsProjects</code>](#LaunchDarklyUtilsProjects)  
**Fulfil**: <code>Object</code> an empty project  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| projectKey | <code>\*</code> | projectKey a key that identifies the project |

**Example**  
```js
ldutils deleteProject new-project
```
<a name="LaunchDarklyUtilsRoles"></a>

## LaunchDarklyUtilsRoles
**Kind**: global class  

* [LaunchDarklyUtilsRoles](#LaunchDarklyUtilsRoles)
    * [new LaunchDarklyUtilsRoles(apiClient, log, ldUtils)](#new_LaunchDarklyUtilsRoles_new)
    * [.API_GROUP](#LaunchDarklyUtilsRoles+API_GROUP) ⇒ <code>string</code>
    * [.getCustomRoles()](#LaunchDarklyUtilsRoles+getCustomRoles) ⇒ <code>Promise</code>
    * [.getCustomRole(customRoleKey)](#LaunchDarklyUtilsRoles+getCustomRole) ⇒ <code>Promise</code>
    * [.getCustomRoleById(customRoleId)](#LaunchDarklyUtilsRoles+getCustomRoleById) ⇒ <code>Promise</code>
    * [.createCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription)](#LaunchDarklyUtilsRoles+createCustomRole) ⇒ <code>Promise</code>
    * [.updateCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription)](#LaunchDarklyUtilsRoles+updateCustomRole) ⇒ <code>Promise</code>
    * [.upsertCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription)](#LaunchDarklyUtilsRoles+upsertCustomRole) ⇒ <code>Promise</code>
    * [.bulkUpsertCustomRoles(roleBulkLoadFile)](#LaunchDarklyUtilsRoles+bulkUpsertCustomRoles) ⇒ <code>Promise</code>
    * [.bulkUpsertCustomRoleFolder(roleFolder)](#LaunchDarklyUtilsRoles+bulkUpsertCustomRoleFolder) ⇒ <code>Promise</code>

<a name="new_LaunchDarklyUtilsRoles_new"></a>

### new LaunchDarklyUtilsRoles(apiClient, log, ldUtils)
Custom role specific api functions attached as 'LaunchDarklyUtils.roles'

**Returns**: [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles) - custom flag api functions  

| Param | Type | Description |
| --- | --- | --- |
| apiClient | <code>Swagger</code> | generated launchdarkly apiClient |
| log | <code>Object</code> | logger implementation, or 'console' |
| ldUtils | [<code>LaunchDarklyUtils</code>](#LaunchDarklyUtils) | primary utils class |

<a name="LaunchDarklyUtilsRoles+API_GROUP"></a>

### launchDarklyUtilsRoles.API\_GROUP ⇒ <code>string</code>
Api group object key in LD api

**Kind**: instance property of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
<a name="LaunchDarklyUtilsRoles+getCustomRoles"></a>

### launchDarklyUtilsRoles.getCustomRoles() ⇒ <code>Promise</code>
Get all custom roles in account

**Kind**: instance method of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
**Fulfil**: <code>Object</code> custom role list json  
**Reject**: <code>Error</code> object with message  
**Example**  
```js
ldutils getTeamMemberCustomRoles owner-sample-account@launchdarkly.com
```
<a name="LaunchDarklyUtilsRoles+getCustomRole"></a>

### launchDarklyUtilsRoles.getCustomRole(customRoleKey) ⇒ <code>Promise</code>
Get a single custom role by key

**Kind**: instance method of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
**Fulfil**: <code>Object</code> custom role json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| customRoleKey | <code>string</code> | custom role key |

**Example**  
```js
ldutils getCustomRole my-role
```
<a name="LaunchDarklyUtilsRoles+getCustomRoleById"></a>

### launchDarklyUtilsRoles.getCustomRoleById(customRoleId) ⇒ <code>Promise</code>
Get a single role by _id

**Kind**: instance method of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
**Fulfil**: <code>Object</code> custom role json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| customRoleId | <code>string</code> | custom role _id |

**Example**  
```js
ldutils getCustomRoleById <id>
```
<a name="LaunchDarklyUtilsRoles+createCustomRole"></a>

### launchDarklyUtilsRoles.createCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒ <code>Promise</code>
Create a new custom role

**Kind**: instance method of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
**Fulfil**: <code>Object</code> custom role json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| customRoleKey | <code>string</code> | custom role key |
| customRoleName | <code>string</code> | custom role name |
| customRolePolicyArray | <code>string</code> | array of policy objects per https://docs.launchdarkly.com/docs/custom-roles |
| customRoleDescription | <code>string</code> | user friendly description |

**Example**  
```js
ldutils createCustomRole my-role "My Role" [policyArrayJson] "some description"
```
<a name="LaunchDarklyUtilsRoles+updateCustomRole"></a>

### launchDarklyUtilsRoles.updateCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒ <code>Promise</code>
Update an existing custom role

**Kind**: instance method of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
**Fulfil**: <code>Object</code> updated custom role json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| customRoleKey | <code>string</code> | custom role key |
| customRoleName | <code>string</code> | custom role name |
| customRolePolicyArray | <code>string</code> | array of policy objects per https://docs.launchdarkly.com/docs/custom-roles |
| customRoleDescription | <code>string</code> | user friendly description |

**Example**  
```js
ldutils updateCustomRole my-role "My Role" [policyArrayJson] "some description"
```
<a name="LaunchDarklyUtilsRoles+upsertCustomRole"></a>

### launchDarklyUtilsRoles.upsertCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒ <code>Promise</code>
Check for existence of role by key; update if exists, otherwise create new role

**Kind**: instance method of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
**Fulfil**: <code>Object</code> updated/created custom role json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| customRoleKey | <code>string</code> | custom role key |
| customRoleName | <code>string</code> | custom role name |
| customRolePolicyArray | <code>string</code> | array of policy objects per https://docs.launchdarkly.com/docs/custom-roles |
| customRoleDescription | <code>string</code> | user friendly description |

**Example**  
```js
ldutils upsertCustomRole my-role "My Role" [policyArrayJson] "some description"
```
<a name="LaunchDarklyUtilsRoles+bulkUpsertCustomRoles"></a>

### launchDarklyUtilsRoles.bulkUpsertCustomRoles(roleBulkLoadFile) ⇒ <code>Promise</code>
Load a file of custom role json, and update/create roles based on this

**Kind**: instance method of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
**Fulfil**: <code>Object</code> array of updated/created role json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| roleBulkLoadFile | <code>string</code> | path to json file (eg. exampleRoleBulkLoad.json) |

**Example**  
```js
ldutils bulkUpsertCustomRoles ./my-roles.json
```
<a name="LaunchDarklyUtilsRoles+bulkUpsertCustomRoleFolder"></a>

### launchDarklyUtilsRoles.bulkUpsertCustomRoleFolder(roleFolder) ⇒ <code>Promise</code>
Create/update custom roles based on a folder of multiple json files

**Kind**: instance method of [<code>LaunchDarklyUtilsRoles</code>](#LaunchDarklyUtilsRoles)  
**Fulfil**: <code>Object</code> array of updated/created role json  
**Reject**: <code>Error</code> object with message  

| Param | Type | Description |
| --- | --- | --- |
| roleFolder | <code>string</code> | path to folder containing json |

**Example**  
```js
ldutils bulkUpsertCustomRoleFolder ./my-roles-dir-containing json
```
