## 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="#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) ⇒ <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 |

<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) ⇒ <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 |

<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>

<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 |

<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 |

<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 |

<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 |

<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 |

<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 |

<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()](#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>

<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() ⇒ <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  
<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 |

<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 |

<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 |

<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  
<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 |

<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 |

<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 |

<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 |

<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 |

<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) |

<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 |

