/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

const msRest = require('ms-rest');
const WebResource = msRest.WebResource;

/**
 * Adds an intent classifier to the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} intentCreateObject A model object containing the name of the
 * new intent classifier.
 *
 * @param {string} [intentCreateObject.name] Name of the new entity extractor.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addIntent(appId, versionId, intentCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (intentCreateObject === null || intentCreateObject === undefined) {
      throw new Error('intentCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/intents';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (intentCreateObject !== null && intentCreateObject !== undefined) {
      let requestModelMapper = new client.models['ModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, intentCreateObject, 'intentCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(intentCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the intent models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listIntents(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/intents';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'IntentClassifierElementType',
                  type: {
                    name: 'Composite',
                    className: 'IntentClassifier'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds an entity extractor to the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} modelCreateObject A model object containing the name for the
 * new entity extractor.
 *
 * @param {string} [modelCreateObject.name] Name of the new entity extractor.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addEntity(appId, versionId, modelCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (modelCreateObject === null || modelCreateObject === undefined) {
      throw new Error('modelCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (modelCreateObject !== null && modelCreateObject !== undefined) {
      let requestModelMapper = new client.models['ModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, modelCreateObject, 'modelCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(modelCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the entity models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listEntities(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a hierarchical entity extractor to the application version.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} hierarchicalModelCreateObject A model containing the name
 * and children of the new entity extractor.
 *
 * @param {array} [hierarchicalModelCreateObject.children] Child entities.
 *
 * @param {string} [hierarchicalModelCreateObject.name] Entity name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addHierarchicalEntity(appId, versionId, hierarchicalModelCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hierarchicalModelCreateObject === null || hierarchicalModelCreateObject === undefined) {
      throw new Error('hierarchicalModelCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (hierarchicalModelCreateObject !== null && hierarchicalModelCreateObject !== undefined) {
      let requestModelMapper = new client.models['HierarchicalEntityModel']().mapper();
      requestModel = client.serialize(requestModelMapper, hierarchicalModelCreateObject, 'hierarchicalModelCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(hierarchicalModelCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the hierarchical entity models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listHierarchicalEntities(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'HierarchicalEntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'HierarchicalEntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a composite entity extractor to the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} compositeModelCreateObject A model containing the name and
 * children of the new entity extractor.
 *
 * @param {array} [compositeModelCreateObject.children] Child entities.
 *
 * @param {string} [compositeModelCreateObject.name] Entity name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addCompositeEntity(appId, versionId, compositeModelCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (compositeModelCreateObject === null || compositeModelCreateObject === undefined) {
      throw new Error('compositeModelCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (compositeModelCreateObject !== null && compositeModelCreateObject !== undefined) {
      let requestModelMapper = new client.models['CompositeEntityModel']().mapper();
      requestModel = client.serialize(requestModelMapper, compositeModelCreateObject, 'compositeModelCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(compositeModelCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the composite entity models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listCompositeEntities(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'CompositeEntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'CompositeEntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the closedlist models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listClosedLists(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ClosedListEntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'ClosedListEntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a closed list model to the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} closedListModelCreateObject A model containing the name and
 * words for the new closed list entity extractor.
 *
 * @param {array} [closedListModelCreateObject.subLists] Sublists for the
 * feature.
 *
 * @param {string} [closedListModelCreateObject.name] Name of the closed list
 * feature.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addClosedList(appId, versionId, closedListModelCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (closedListModelCreateObject === null || closedListModelCreateObject === undefined) {
      throw new Error('closedListModelCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (closedListModelCreateObject !== null && closedListModelCreateObject !== undefined) {
      let requestModelMapper = new client.models['ClosedListModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, closedListModelCreateObject, 'closedListModelCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(closedListModelCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a list of prebuilt entity extractors to the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {array} prebuiltExtractorNames An array of prebuilt entity extractor
 * names.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addPrebuilt(appId, versionId, prebuiltExtractorNames, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (!Array.isArray(prebuiltExtractorNames)) {
      throw new Error('prebuiltExtractorNames cannot be null or undefined and it must be of type array.');
    }
    for (let i = 0; i < prebuiltExtractorNames.length; i++) {
      if (prebuiltExtractorNames[i] !== null && prebuiltExtractorNames[i] !== undefined && typeof prebuiltExtractorNames[i].valueOf() !== 'string') {
        throw new Error('prebuiltExtractorNames[i] must be of type string.');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (prebuiltExtractorNames !== null && prebuiltExtractorNames !== undefined) {
      let requestModelMapper = {
        required: true,
        serializedName: 'prebuiltExtractorNames',
        type: {
          name: 'Sequence',
          element: {
              required: false,
              serializedName: 'StringElementType',
              type: {
                name: 'String'
              }
          }
        }
      };
      requestModel = client.serialize(requestModelMapper, prebuiltExtractorNames, 'prebuiltExtractorNames');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(prebuiltExtractorNames, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'PrebuiltEntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'PrebuiltEntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the prebuilt entity models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listPrebuilts(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'PrebuiltEntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'PrebuiltEntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets all the available prebuilt entity extractors for the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listPrebuiltEntities(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/listprebuilts';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'AvailablePrebuiltEntityModelElementType',
                  type: {
                    name: 'Composite',
                    className: 'AvailablePrebuiltEntityModel'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the application version models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listModels(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/models';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ModelInfoResponseElementType',
                  type: {
                    name: 'Composite',
                    className: 'ModelInfoResponse'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets the utterances for the given model in the given app version.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {string} modelId The ID (GUID) of the model.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _examplesMethod(appId, versionId, modelId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (modelId === null || modelId === undefined || typeof modelId.valueOf() !== 'string') {
      throw new Error('modelId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/models/{modelId}/examples';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{modelId}', encodeURIComponent(modelId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'LabelTextObjectElementType',
                  type: {
                    name: 'Composite',
                    className: 'LabelTextObject'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the intent model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} intentId The intent classifier ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link IntentClassifier} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getIntent(appId, versionId, intentId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (intentId === null || intentId === undefined || typeof intentId.valueOf() !== 'string' || !msRest.isValidUuid(intentId)) {
      throw new Error('intentId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/intents/{intentId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{intentId}', encodeURIComponent(intentId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['IntentClassifier']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Updates the name of an intent classifier.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} intentId The intent classifier ID.
 *
 * @param {object} modelUpdateObject A model object containing the new intent
 * classifier name.
 *
 * @param {string} [modelUpdateObject.name] The entity's new name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateIntent(appId, versionId, intentId, modelUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (intentId === null || intentId === undefined || typeof intentId.valueOf() !== 'string' || !msRest.isValidUuid(intentId)) {
      throw new Error('intentId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (modelUpdateObject === null || modelUpdateObject === undefined) {
      throw new Error('modelUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/intents/{intentId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{intentId}', encodeURIComponent(intentId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (modelUpdateObject !== null && modelUpdateObject !== undefined) {
      let requestModelMapper = new client.models['ModelUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, modelUpdateObject, 'modelUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(modelUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes an intent classifier from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} intentId The intent classifier ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {boolean} [options.deleteUtterances] Also delete the intent's
 * utterances (true). Or move the utterances to the None intent (false - the
 * default value).
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteIntent(appId, versionId, intentId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let deleteUtterances = (options && options.deleteUtterances !== undefined) ? options.deleteUtterances : false;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (intentId === null || intentId === undefined || typeof intentId.valueOf() !== 'string' || !msRest.isValidUuid(intentId)) {
      throw new Error('intentId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (deleteUtterances !== null && deleteUtterances !== undefined && typeof deleteUtterances !== 'boolean') {
      throw new Error('deleteUtterances must be of type boolean.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/intents/{intentId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{intentId}', encodeURIComponent(intentId.toString()));
  let queryParameters = [];
  if (deleteUtterances !== null && deleteUtterances !== undefined) {
    queryParameters.push('deleteUtterances=' + encodeURIComponent(deleteUtterances.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityExtractor} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getEntity(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityExtractor']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Updates the name of an entity extractor.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity extractor ID.
 *
 * @param {object} modelUpdateObject A model object containing the new entity
 * extractor name.
 *
 * @param {string} [modelUpdateObject.name] The entity's new name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateEntity(appId, versionId, entityId, modelUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (modelUpdateObject === null || modelUpdateObject === undefined) {
      throw new Error('modelUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (modelUpdateObject !== null && modelUpdateObject !== undefined) {
      let requestModelMapper = new client.models['ModelUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, modelUpdateObject, 'modelUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(modelUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes an entity extractor from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteEntity(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the hierarchical entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link HierarchicalEntityExtractor} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getHierarchicalEntity(appId, versionId, hEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['HierarchicalEntityExtractor']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Updates the name and children of a hierarchical entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {object} hierarchicalModelUpdateObject Model containing names of the
 * children of the hierarchical entity.
 *
 * @param {array} [hierarchicalModelUpdateObject.children] Child entities.
 *
 * @param {string} [hierarchicalModelUpdateObject.name] Entity name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateHierarchicalEntity(appId, versionId, hEntityId, hierarchicalModelUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (hierarchicalModelUpdateObject === null || hierarchicalModelUpdateObject === undefined) {
      throw new Error('hierarchicalModelUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (hierarchicalModelUpdateObject !== null && hierarchicalModelUpdateObject !== undefined) {
      let requestModelMapper = new client.models['HierarchicalEntityModel']().mapper();
      requestModel = client.serialize(requestModelMapper, hierarchicalModelUpdateObject, 'hierarchicalModelUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(hierarchicalModelUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes a hierarchical entity extractor from the application version.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteHierarchicalEntity(appId, versionId, hEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the composite entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link CompositeEntityExtractor} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getCompositeEntity(appId, versionId, cEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['CompositeEntityExtractor']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Updates the composite entity extractor.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {object} compositeModelUpdateObject A model object containing the new
 * entity extractor name and children.
 *
 * @param {array} [compositeModelUpdateObject.children] Child entities.
 *
 * @param {string} [compositeModelUpdateObject.name] Entity name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateCompositeEntity(appId, versionId, cEntityId, compositeModelUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (compositeModelUpdateObject === null || compositeModelUpdateObject === undefined) {
      throw new Error('compositeModelUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (compositeModelUpdateObject !== null && compositeModelUpdateObject !== undefined) {
      let requestModelMapper = new client.models['CompositeEntityModel']().mapper();
      requestModel = client.serialize(requestModelMapper, compositeModelUpdateObject, 'compositeModelUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(compositeModelUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes a composite entity extractor from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteCompositeEntity(appId, versionId, cEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information of a closed list model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} clEntityId The closed list model ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link ClosedListEntityExtractor} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getClosedList(appId, versionId, clEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (clEntityId === null || clEntityId === undefined || typeof clEntityId.valueOf() !== 'string' || !msRest.isValidUuid(clEntityId)) {
      throw new Error('clEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{clEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{clEntityId}', encodeURIComponent(clEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['ClosedListEntityExtractor']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Updates the closed list model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} clEntityId The closed list model ID.
 *
 * @param {object} closedListModelUpdateObject The new entity name and words
 * list.
 *
 * @param {array} [closedListModelUpdateObject.subLists] The new sublists for
 * the feature.
 *
 * @param {string} [closedListModelUpdateObject.name] The new name of the
 * closed list feature.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateClosedList(appId, versionId, clEntityId, closedListModelUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (clEntityId === null || clEntityId === undefined || typeof clEntityId.valueOf() !== 'string' || !msRest.isValidUuid(clEntityId)) {
      throw new Error('clEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (closedListModelUpdateObject === null || closedListModelUpdateObject === undefined) {
      throw new Error('closedListModelUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{clEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{clEntityId}', encodeURIComponent(clEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (closedListModelUpdateObject !== null && closedListModelUpdateObject !== undefined) {
      let requestModelMapper = new client.models['ClosedListModelUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, closedListModelUpdateObject, 'closedListModelUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(closedListModelUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a batch of sublists to an existing closedlist.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} clEntityId The closed list model ID.
 *
 * @param {object} closedListModelPatchObject A words list batch.
 *
 * @param {array} [closedListModelPatchObject.subLists] Sublists to add.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _patchClosedList(appId, versionId, clEntityId, closedListModelPatchObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (clEntityId === null || clEntityId === undefined || typeof clEntityId.valueOf() !== 'string' || !msRest.isValidUuid(clEntityId)) {
      throw new Error('clEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (closedListModelPatchObject === null || closedListModelPatchObject === undefined) {
      throw new Error('closedListModelPatchObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{clEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{clEntityId}', encodeURIComponent(clEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PATCH';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (closedListModelPatchObject !== null && closedListModelPatchObject !== undefined) {
      let requestModelMapper = new client.models['ClosedListModelPatchObject']().mapper();
      requestModel = client.serialize(requestModelMapper, closedListModelPatchObject, 'closedListModelPatchObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(closedListModelPatchObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes a closed list model from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} clEntityId The closed list model ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteClosedList(appId, versionId, clEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (clEntityId === null || clEntityId === undefined || typeof clEntityId.valueOf() !== 'string' || !msRest.isValidUuid(clEntityId)) {
      throw new Error('clEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{clEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{clEntityId}', encodeURIComponent(clEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the prebuilt entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} prebuiltId The prebuilt entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link PrebuiltEntityExtractor} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getPrebuilt(appId, versionId, prebuiltId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (prebuiltId === null || prebuiltId === undefined || typeof prebuiltId.valueOf() !== 'string' || !msRest.isValidUuid(prebuiltId)) {
      throw new Error('prebuiltId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts/{prebuiltId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{prebuiltId}', encodeURIComponent(prebuiltId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['PrebuiltEntityExtractor']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes a prebuilt entity extractor from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} prebuiltId The prebuilt entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deletePrebuilt(appId, versionId, prebuiltId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (prebuiltId === null || prebuiltId === undefined || typeof prebuiltId.valueOf() !== 'string' || !msRest.isValidUuid(prebuiltId)) {
      throw new Error('prebuiltId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts/{prebuiltId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{prebuiltId}', encodeURIComponent(prebuiltId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes a sublist of a specific closed list model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} clEntityId The closed list entity extractor ID.
 *
 * @param {number} subListId The sublist ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteSubList(appId, versionId, clEntityId, subListId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (clEntityId === null || clEntityId === undefined || typeof clEntityId.valueOf() !== 'string' || !msRest.isValidUuid(clEntityId)) {
      throw new Error('clEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (subListId === null || subListId === undefined || typeof subListId !== 'number') {
      throw new Error('subListId cannot be null or undefined and it must be of type number.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{clEntityId}/sublists/{subListId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{clEntityId}', encodeURIComponent(clEntityId.toString()));
  requestUrl = requestUrl.replace('{subListId}', encodeURIComponent(subListId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Updates one of the closed list's sublists.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} clEntityId The closed list entity extractor ID.
 *
 * @param {number} subListId The sublist ID.
 *
 * @param {object} wordListBaseUpdateObject A sublist update object containing
 * the new canonical form and the list of words.
 *
 * @param {string} [wordListBaseUpdateObject.canonicalForm] The standard form
 * that the list represents.
 *
 * @param {array} [wordListBaseUpdateObject.list] List of synonym words.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateSubList(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (clEntityId === null || clEntityId === undefined || typeof clEntityId.valueOf() !== 'string' || !msRest.isValidUuid(clEntityId)) {
      throw new Error('clEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (subListId === null || subListId === undefined || typeof subListId !== 'number') {
      throw new Error('subListId cannot be null or undefined and it must be of type number.');
    }
    if (wordListBaseUpdateObject === null || wordListBaseUpdateObject === undefined) {
      throw new Error('wordListBaseUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{clEntityId}/sublists/{subListId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{clEntityId}', encodeURIComponent(clEntityId.toString()));
  requestUrl = requestUrl.replace('{subListId}', encodeURIComponent(subListId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (wordListBaseUpdateObject !== null && wordListBaseUpdateObject !== undefined) {
      let requestModelMapper = new client.models['WordListBaseUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, wordListBaseUpdateObject, 'wordListBaseUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(wordListBaseUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Suggests examples that would improve the accuracy of the intent model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} intentId The intent classifier ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getIntentSuggestions(appId, versionId, intentId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (intentId === null || intentId === undefined || typeof intentId.valueOf() !== 'string' || !msRest.isValidUuid(intentId)) {
      throw new Error('intentId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/intents/{intentId}/suggest';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{intentId}', encodeURIComponent(intentId.toString()));
  let queryParameters = [];
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'IntentsSuggestionExampleElementType',
                  type: {
                    name: 'Composite',
                    className: 'IntentsSuggestionExample'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Get suggestion examples that would improve the accuracy of the entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The target entity extractor model to enhance.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getEntitySuggestions(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}/suggest';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  let queryParameters = [];
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntitiesSuggestionExampleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntitiesSuggestionExample'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a list to an existing closed list.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} clEntityId The closed list entity extractor ID.
 *
 * @param {object} wordListCreateObject Words list.
 *
 * @param {string} [wordListCreateObject.canonicalForm] The standard form that
 * the list represents.
 *
 * @param {array} [wordListCreateObject.list] List of synonym words.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {number} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addSubList(appId, versionId, clEntityId, wordListCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (clEntityId === null || clEntityId === undefined || typeof clEntityId.valueOf() !== 'string' || !msRest.isValidUuid(clEntityId)) {
      throw new Error('clEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (wordListCreateObject === null || wordListCreateObject === undefined) {
      throw new Error('wordListCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{clEntityId}/sublists';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{clEntityId}', encodeURIComponent(clEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (wordListCreateObject !== null && wordListCreateObject !== undefined) {
      let requestModelMapper = new client.models['WordListObject']().mapper();
      requestModel = client.serialize(requestModelMapper, wordListCreateObject, 'wordListCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(wordListCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Number'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a customizable prebuilt domain along with all of its models to this
 * application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} prebuiltDomainObject A prebuilt domain create object
 * containing the name of the domain.
 *
 * @param {string} [prebuiltDomainObject.domainName] The domain name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addCustomPrebuiltDomain(appId, versionId, prebuiltDomainObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (prebuiltDomainObject === null || prebuiltDomainObject === undefined) {
      throw new Error('prebuiltDomainObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltdomains';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (prebuiltDomainObject !== null && prebuiltDomainObject !== undefined) {
      let requestModelMapper = new client.models['PrebuiltDomainCreateBaseObject']().mapper();
      requestModel = client.serialize(requestModelMapper, prebuiltDomainObject, 'prebuiltDomainObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(prebuiltDomainObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'UuidElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a custom prebuilt intent model to the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} prebuiltDomainModelCreateObject A model object containing
 * the name of the custom prebuilt intent and the name of the domain to which
 * this model belongs.
 *
 * @param {string} [prebuiltDomainModelCreateObject.domainName] The domain
 * name.
 *
 * @param {string} [prebuiltDomainModelCreateObject.modelName] The intent name
 * or entity name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addCustomPrebuiltIntent(appId, versionId, prebuiltDomainModelCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (prebuiltDomainModelCreateObject === null || prebuiltDomainModelCreateObject === undefined) {
      throw new Error('prebuiltDomainModelCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltintents';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (prebuiltDomainModelCreateObject !== null && prebuiltDomainModelCreateObject !== undefined) {
      let requestModelMapper = new client.models['PrebuiltDomainModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, prebuiltDomainModelCreateObject, 'prebuiltDomainModelCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(prebuiltDomainModelCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets custom prebuilt intents information of this application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listCustomPrebuiltIntents(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltintents';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'IntentClassifierElementType',
                  type: {
                    name: 'Composite',
                    className: 'IntentClassifier'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Adds a custom prebuilt entity model to the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} prebuiltDomainModelCreateObject A model object containing
 * the name of the custom prebuilt entity and the name of the domain to which
 * this model belongs.
 *
 * @param {string} [prebuiltDomainModelCreateObject.domainName] The domain
 * name.
 *
 * @param {string} [prebuiltDomainModelCreateObject.modelName] The intent name
 * or entity name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addCustomPrebuiltEntity(appId, versionId, prebuiltDomainModelCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (prebuiltDomainModelCreateObject === null || prebuiltDomainModelCreateObject === undefined) {
      throw new Error('prebuiltDomainModelCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (prebuiltDomainModelCreateObject !== null && prebuiltDomainModelCreateObject !== undefined) {
      let requestModelMapper = new client.models['PrebuiltDomainModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, prebuiltDomainModelCreateObject, 'prebuiltDomainModelCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(prebuiltDomainModelCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets all custom prebuilt entities information of this application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listCustomPrebuiltEntities(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets all custom prebuilt models information of this application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _listCustomPrebuiltModels(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltmodels';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'CustomPrebuiltModelElementType',
                  type: {
                    name: 'Composite',
                    className: 'CustomPrebuiltModel'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes a prebuilt domain's models from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {string} domainName Domain name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteCustomPrebuiltDomain(appId, versionId, domainName, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (domainName === null || domainName === undefined || typeof domainName.valueOf() !== 'string') {
      throw new Error('domainName cannot be null or undefined and it must be of type string.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltdomains/{domainName}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{domainName}', encodeURIComponent(domainName));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Gets information about the hierarchical entity child model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {uuid} hChildId The hierarchical entity extractor child ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link HierarchicalChildEntity} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (hChildId === null || hChildId === undefined || typeof hChildId.valueOf() !== 'string' || !msRest.isValidUuid(hChildId)) {
      throw new Error('hChildId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));
  requestUrl = requestUrl.replace('{hChildId}', encodeURIComponent(hChildId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['HierarchicalChildEntity']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Renames a single child in an existing hierarchical entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {uuid} hChildId The hierarchical entity extractor child ID.
 *
 * @param {object} hierarchicalChildModelUpdateObject Model object containing
 * new name of the hierarchical entity child.
 *
 * @param {string} [hierarchicalChildModelUpdateObject.name]
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, hierarchicalChildModelUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (hChildId === null || hChildId === undefined || typeof hChildId.valueOf() !== 'string' || !msRest.isValidUuid(hChildId)) {
      throw new Error('hChildId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (hierarchicalChildModelUpdateObject === null || hierarchicalChildModelUpdateObject === undefined) {
      throw new Error('hierarchicalChildModelUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));
  requestUrl = requestUrl.replace('{hChildId}', encodeURIComponent(hChildId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (hierarchicalChildModelUpdateObject !== null && hierarchicalChildModelUpdateObject !== undefined) {
      let requestModelMapper = new client.models['HierarchicalChildModelUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, hierarchicalChildModelUpdateObject, 'hierarchicalChildModelUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(hierarchicalChildModelUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes a hierarchical entity extractor child from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {uuid} hChildId The hierarchical entity extractor child ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (hChildId === null || hChildId === undefined || typeof hChildId.valueOf() !== 'string' || !msRest.isValidUuid(hChildId)) {
      throw new Error('hChildId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children/{hChildId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));
  requestUrl = requestUrl.replace('{hChildId}', encodeURIComponent(hChildId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Creates a single child in an existing hierarchical entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {object} hierarchicalChildModelCreateObject A model object containing
 * the name of the new hierarchical child model.
 *
 * @param {string} [hierarchicalChildModelCreateObject.name]
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addHierarchicalEntityChild(appId, versionId, hEntityId, hierarchicalChildModelCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (hierarchicalChildModelCreateObject === null || hierarchicalChildModelCreateObject === undefined) {
      throw new Error('hierarchicalChildModelCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/children';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (hierarchicalChildModelCreateObject !== null && hierarchicalChildModelCreateObject !== undefined) {
      let requestModelMapper = new client.models['HierarchicalChildModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, hierarchicalChildModelCreateObject, 'hierarchicalChildModelCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(hierarchicalChildModelCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Creates a single child in an existing composite entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {object} compositeChildModelCreateObject A model object containing
 * the name of the new composite child model.
 *
 * @param {string} [compositeChildModelCreateObject.name]
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addCompositeEntityChild(appId, versionId, cEntityId, compositeChildModelCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (compositeChildModelCreateObject === null || compositeChildModelCreateObject === undefined) {
      throw new Error('compositeChildModelCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/children';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (compositeChildModelCreateObject !== null && compositeChildModelCreateObject !== undefined) {
      let requestModelMapper = new client.models['CompositeChildModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, compositeChildModelCreateObject, 'compositeChildModelCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(compositeChildModelCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * Deletes a composite entity extractor child from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {uuid} cChildId The hierarchical entity extractor child ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteCompositeEntityChild(appId, versionId, cEntityId, cChildId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (cChildId === null || cChildId === undefined || typeof cChildId.valueOf() !== 'string' || !msRest.isValidUuid(cChildId)) {
      throw new Error('cChildId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/children/{cChildId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));
  requestUrl = requestUrl.replace('{cChildId}', encodeURIComponent(cChildId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Gets information about the regex entity models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getRegexEntityInfos(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'RegexEntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'RegexEntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Adds a regex entity model to the application version.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} regexEntityExtractorCreateObj A model object containing the
 * name and regex pattern for the new regex entity extractor.
 *
 * @param {string} [regexEntityExtractorCreateObj.regexPattern] The regex
 * entity pattern.
 *
 * @param {string} [regexEntityExtractorCreateObj.name] The model name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createRegexEntityModel(appId, versionId, regexEntityExtractorCreateObj, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (regexEntityExtractorCreateObj === null || regexEntityExtractorCreateObj === undefined) {
      throw new Error('regexEntityExtractorCreateObj cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (regexEntityExtractorCreateObj !== null && regexEntityExtractorCreateObj !== undefined) {
      let requestModelMapper = new client.models['RegexModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, regexEntityExtractorCreateObj, 'regexEntityExtractorCreateObj');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(regexEntityExtractorCreateObj, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get information about the Pattern.Any entity models.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {number} [options.skip] The number of entries to skip. Default value
 * is 0.
 *
 * @param {number} [options.take] The number of entries to return. Maximum page
 * size is 500. Default is 100.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getPatternAnyEntityInfos(appId, versionId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  let skip = (options && options.skip !== undefined) ? options.skip : 0;
  let take = (options && options.take !== undefined) ? options.take : 100;
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (skip !== null && skip !== undefined && typeof skip !== 'number') {
      throw new Error('skip must be of type number.');
    }
    if (skip !== null && skip !== undefined) {
      if (skip < 0)
      {
        throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
    if (take !== null && take !== undefined && typeof take !== 'number') {
      throw new Error('take must be of type number.');
    }
    if (take !== null && take !== undefined) {
      if (take > 500)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMaximum": 500');
      }
      if (take < 0)
      {
        throw new Error('"take" should satisfy the constraint - "InclusiveMinimum": 0');
      }
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  let queryParameters = [];
  if (skip !== null && skip !== undefined) {
    queryParameters.push('skip=' + encodeURIComponent(skip.toString()));
  }
  if (take !== null && take !== undefined) {
    queryParameters.push('take=' + encodeURIComponent(take.toString()));
  }
  if (queryParameters.length > 0) {
    requestUrl += '?' + queryParameters.join('&');
  }

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'PatternAnyEntityExtractorElementType',
                  type: {
                    name: 'Composite',
                    className: 'PatternAnyEntityExtractor'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Adds a pattern.any entity extractor to the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {object} extractorCreateObject A model object containing the name and
 * explicit list for the new Pattern.Any entity extractor.
 *
 * @param {string} [extractorCreateObject.name] The model name.
 *
 * @param {array} [extractorCreateObject.explicitList] The Pattern.Any explicit
 * list.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createPatternAnyEntityModel(appId, versionId, extractorCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (extractorCreateObject === null || extractorCreateObject === undefined) {
      throw new Error('extractorCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (extractorCreateObject !== null && extractorCreateObject !== undefined) {
      let requestModelMapper = new client.models['PatternAnyModelCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, extractorCreateObject, 'extractorCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(extractorCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get All Entity Roles for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity Id
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getEntityRoles(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityRole'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Create an entity role for an entity in the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity model ID.
 *
 * @param {object} entityRoleCreateObject An entity role object containing the
 * name of role.
 *
 * @param {string} [entityRoleCreateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleCreateObject === null || entityRoleCreateObject === undefined) {
      throw new Error('entityRoleCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleCreateObject !== null && entityRoleCreateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleCreateObject, 'entityRoleCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get All Entity Roles for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity Id
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getPrebuiltEntityRoles(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityRole'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Create an entity role for an entity in the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity model ID.
 *
 * @param {object} entityRoleCreateObject An entity role object containing the
 * name of role.
 *
 * @param {string} [entityRoleCreateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleCreateObject === null || entityRoleCreateObject === undefined) {
      throw new Error('entityRoleCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleCreateObject !== null && entityRoleCreateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleCreateObject, 'entityRoleCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get All Entity Roles for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity Id
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getClosedListEntityRoles(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityRole'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Create an entity role for an entity in the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity model ID.
 *
 * @param {object} entityRoleCreateObject An entity role object containing the
 * name of role.
 *
 * @param {string} [entityRoleCreateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createClosedListEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleCreateObject === null || entityRoleCreateObject === undefined) {
      throw new Error('entityRoleCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleCreateObject !== null && entityRoleCreateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleCreateObject, 'entityRoleCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get All Entity Roles for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity Id
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getRegexEntityRoles(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityRole'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Create an entity role for an entity in the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity model ID.
 *
 * @param {object} entityRoleCreateObject An entity role object containing the
 * name of role.
 *
 * @param {string} [entityRoleCreateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createRegexEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleCreateObject === null || entityRoleCreateObject === undefined) {
      throw new Error('entityRoleCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleCreateObject !== null && entityRoleCreateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleCreateObject, 'entityRoleCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get All Entity Roles for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getCompositeEntityRoles(appId, versionId, cEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityRole'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Create an entity role for an entity in the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {object} entityRoleCreateObject An entity role object containing the
 * name of role.
 *
 * @param {string} [entityRoleCreateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createCompositeEntityRole(appId, versionId, cEntityId, entityRoleCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleCreateObject === null || entityRoleCreateObject === undefined) {
      throw new Error('entityRoleCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleCreateObject !== null && entityRoleCreateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleCreateObject, 'entityRoleCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get All Entity Roles for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity Id
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getPatternAnyEntityRoles(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityRole'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Create an entity role for an entity in the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity model ID.
 *
 * @param {object} entityRoleCreateObject An entity role object containing the
 * name of role.
 *
 * @param {string} [entityRoleCreateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createPatternAnyEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleCreateObject === null || entityRoleCreateObject === undefined) {
      throw new Error('entityRoleCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleCreateObject !== null && entityRoleCreateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleCreateObject, 'entityRoleCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get All Entity Roles for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getHierarchicalEntityRoles(appId, versionId, hEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityRole'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Create an entity role for an entity in the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {object} entityRoleCreateObject An entity role object containing the
 * name of role.
 *
 * @param {string} [entityRoleCreateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createHierarchicalEntityRole(appId, versionId, hEntityId, entityRoleCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleCreateObject === null || entityRoleCreateObject === undefined) {
      throw new Error('entityRoleCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleCreateObject !== null && entityRoleCreateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleCreateObject, 'entityRoleCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get All Entity Roles for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity Id
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getCustomPrebuiltEntityRoles(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'EntityRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'EntityRole'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Create an entity role for an entity in the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity model ID.
 *
 * @param {object} entityRoleCreateObject An entity role object containing the
 * name of role.
 *
 * @param {string} [entityRoleCreateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {uuid} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _createCustomPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleCreateObject === null || entityRoleCreateObject === undefined) {
      throw new Error('entityRoleCreateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleCreateObject !== null && entityRoleCreateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleCreateObject, 'entityRoleCreateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleCreateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'String'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get the explicit list of the pattern.any entity.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The Pattern.Any entity id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {array} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getExplicitList(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ExplicitListItemElementType',
                  type: {
                    name: 'Composite',
                    className: 'ExplicitListItem'
                  }
              }
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Add a new item to the explicit list for the Pattern.Any entity.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The Pattern.Any entity extractor ID.
 *
 * @param {object} item The new explicit list item.
 *
 * @param {string} [item.explicitListItem] The explicit list item.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {number} [result]   - The deserialized result object if an error did not occur.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _addExplicitListItem(appId, versionId, entityId, item, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (item === null || item === undefined) {
      throw new Error('item cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'POST';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (item !== null && item !== undefined) {
      let requestModelMapper = new client.models['ExplicitListItemCreateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, item, 'item');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(item, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 201) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 201) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = {
            required: false,
            serializedName: 'parsedResponse',
            type: {
              name: 'Number'
            }
          };
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Gets information of a regex entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} regexEntityId The regex entity model ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link RegexEntityExtractor} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getRegexEntityEntityInfo(appId, versionId, regexEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (regexEntityId === null || regexEntityId === undefined || typeof regexEntityId.valueOf() !== 'string' || !msRest.isValidUuid(regexEntityId)) {
      throw new Error('regexEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities/{regexEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{regexEntityId}', encodeURIComponent(regexEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['RegexEntityExtractor']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Updates the regex entity model .
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} regexEntityId The regex entity extractor ID.
 *
 * @param {object} regexEntityUpdateObject An object containing the new entity
 * name and regex pattern.
 *
 * @param {string} [regexEntityUpdateObject.regexPattern] The regex entity
 * pattern.
 *
 * @param {string} [regexEntityUpdateObject.name] The model name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateRegexEntityModel(appId, versionId, regexEntityId, regexEntityUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (regexEntityId === null || regexEntityId === undefined || typeof regexEntityId.valueOf() !== 'string' || !msRest.isValidUuid(regexEntityId)) {
      throw new Error('regexEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (regexEntityUpdateObject === null || regexEntityUpdateObject === undefined) {
      throw new Error('regexEntityUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities/{regexEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{regexEntityId}', encodeURIComponent(regexEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (regexEntityUpdateObject !== null && regexEntityUpdateObject !== undefined) {
      let requestModelMapper = new client.models['RegexModelUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, regexEntityUpdateObject, 'regexEntityUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(regexEntityUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Deletes a regex entity model from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} regexEntityId The regex entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteRegexEntityModel(appId, versionId, regexEntityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (regexEntityId === null || regexEntityId === undefined || typeof regexEntityId.valueOf() !== 'string' || !msRest.isValidUuid(regexEntityId)) {
      throw new Error('regexEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities/{regexEntityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{regexEntityId}', encodeURIComponent(regexEntityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Gets information about the application version's Pattern.Any model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link PatternAnyEntityExtractor} for more
 *                      information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getPatternAnyEntityInfo(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['PatternAnyEntityExtractor']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Updates the name and explicit list of a Pattern.Any entity model.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The Pattern.Any entity extractor ID.
 *
 * @param {object} patternAnyUpdateObject An object containing the explicit
 * list of the Pattern.Any entity.
 *
 * @param {string} [patternAnyUpdateObject.name] The model name.
 *
 * @param {array} [patternAnyUpdateObject.explicitList] The Pattern.Any
 * explicit list.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updatePatternAnyEntityModel(appId, versionId, entityId, patternAnyUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (patternAnyUpdateObject === null || patternAnyUpdateObject === undefined) {
      throw new Error('patternAnyUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (patternAnyUpdateObject !== null && patternAnyUpdateObject !== undefined) {
      let requestModelMapper = new client.models['PatternAnyModelUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, patternAnyUpdateObject, 'patternAnyUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(patternAnyUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Deletes a Pattern.Any entity extractor from the application.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The Pattern.Any entity extractor ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deletePatternAnyEntityModel(appId, versionId, entityId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get one entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity ID.
 *
 * @param {uuid} roleId entity role ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityRole} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityRole']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Update an entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role ID.
 *
 * @param {object} entityRoleUpdateObject The new entity role.
 *
 * @param {string} [entityRoleUpdateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleUpdateObject === null || entityRoleUpdateObject === undefined) {
      throw new Error('entityRoleUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleUpdateObject !== null && entityRoleUpdateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleUpdateObject, 'entityRoleUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete an entity role.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/entities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get one entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity ID.
 *
 * @param {uuid} roleId entity role ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityRole} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getPrebuiltEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityRole']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Update an entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role ID.
 *
 * @param {object} entityRoleUpdateObject The new entity role.
 *
 * @param {string} [entityRoleUpdateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updatePrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleUpdateObject === null || entityRoleUpdateObject === undefined) {
      throw new Error('entityRoleUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleUpdateObject !== null && entityRoleUpdateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleUpdateObject, 'entityRoleUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete an entity role.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deletePrebuiltEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/prebuilts/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get one entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity ID.
 *
 * @param {uuid} roleId entity role ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityRole} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getClosedListEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityRole']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Update an entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role ID.
 *
 * @param {object} entityRoleUpdateObject The new entity role.
 *
 * @param {string} [entityRoleUpdateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateClosedListEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleUpdateObject === null || entityRoleUpdateObject === undefined) {
      throw new Error('entityRoleUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleUpdateObject !== null && entityRoleUpdateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleUpdateObject, 'entityRoleUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete an entity role.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteClosedListEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/closedlists/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get one entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity ID.
 *
 * @param {uuid} roleId entity role ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityRole} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getRegexEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityRole']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Update an entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role ID.
 *
 * @param {object} entityRoleUpdateObject The new entity role.
 *
 * @param {string} [entityRoleUpdateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateRegexEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleUpdateObject === null || entityRoleUpdateObject === undefined) {
      throw new Error('entityRoleUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleUpdateObject !== null && entityRoleUpdateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleUpdateObject, 'entityRoleUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete an entity role.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteRegexEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/regexentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get one entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {uuid} roleId entity role ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityRole} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getCompositeEntityRole(appId, versionId, cEntityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityRole']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Update an entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {uuid} roleId The entity role ID.
 *
 * @param {object} entityRoleUpdateObject The new entity role.
 *
 * @param {string} [entityRoleUpdateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateCompositeEntityRole(appId, versionId, cEntityId, roleId, entityRoleUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleUpdateObject === null || entityRoleUpdateObject === undefined) {
      throw new Error('entityRoleUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleUpdateObject !== null && entityRoleUpdateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleUpdateObject, 'entityRoleUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete an entity role.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} cEntityId The composite entity extractor ID.
 *
 * @param {uuid} roleId The entity role Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteCompositeEntityRole(appId, versionId, cEntityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (cEntityId === null || cEntityId === undefined || typeof cEntityId.valueOf() !== 'string' || !msRest.isValidUuid(cEntityId)) {
      throw new Error('cEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/compositeentities/{cEntityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{cEntityId}', encodeURIComponent(cEntityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get one entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity ID.
 *
 * @param {uuid} roleId entity role ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityRole} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getPatternAnyEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityRole']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Update an entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role ID.
 *
 * @param {object} entityRoleUpdateObject The new entity role.
 *
 * @param {string} [entityRoleUpdateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updatePatternAnyEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleUpdateObject === null || entityRoleUpdateObject === undefined) {
      throw new Error('entityRoleUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleUpdateObject !== null && entityRoleUpdateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleUpdateObject, 'entityRoleUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete an entity role.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deletePatternAnyEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get one entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {uuid} roleId entity role ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityRole} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityRole']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Update an entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {uuid} roleId The entity role ID.
 *
 * @param {object} entityRoleUpdateObject The new entity role.
 *
 * @param {string} [entityRoleUpdateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateHierarchicalEntityRole(appId, versionId, hEntityId, roleId, entityRoleUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleUpdateObject === null || entityRoleUpdateObject === undefined) {
      throw new Error('entityRoleUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleUpdateObject !== null && entityRoleUpdateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleUpdateObject, 'entityRoleUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete an entity role.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} hEntityId The hierarchical entity extractor ID.
 *
 * @param {uuid} roleId The entity role Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (hEntityId === null || hEntityId === undefined || typeof hEntityId.valueOf() !== 'string' || !msRest.isValidUuid(hEntityId)) {
      throw new Error('hEntityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/hierarchicalentities/{hEntityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{hEntityId}', encodeURIComponent(hEntityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get one entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId entity ID.
 *
 * @param {uuid} roleId entity role ID.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link EntityRole} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getCustomEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['EntityRole']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Update an entity role for a given entity
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role ID.
 *
 * @param {object} entityRoleUpdateObject The new entity role.
 *
 * @param {string} [entityRoleUpdateObject.name] The entity role name.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateCustomPrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (entityRoleUpdateObject === null || entityRoleUpdateObject === undefined) {
      throw new Error('entityRoleUpdateObject cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (entityRoleUpdateObject !== null && entityRoleUpdateObject !== undefined) {
      let requestModelMapper = new client.models['EntityRoleUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, entityRoleUpdateObject, 'entityRoleUpdateObject');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(entityRoleUpdateObject, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete an entity role.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The entity ID.
 *
 * @param {uuid} roleId The entity role Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteCustomEntityRole(appId, versionId, entityId, roleId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (roleId === null || roleId === undefined || typeof roleId.valueOf() !== 'string' || !msRest.isValidUuid(roleId)) {
      throw new Error('roleId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/customprebuiltentities/{entityId}/roles/{roleId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{roleId}', encodeURIComponent(roleId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Get the explicit list of the pattern.any entity.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The Pattern.Any entity Id.
 *
 * @param {number} itemId The explicit list item Id.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link ExplicitListItem} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _getExplicitListItem(appId, versionId, entityId, itemId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (itemId === null || itemId === undefined || typeof itemId !== 'number') {
      throw new Error('itemId cannot be null or undefined and it must be of type number.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist/{itemId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{itemId}', encodeURIComponent(itemId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'GET';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['ExplicitListItem']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Updates an explicit list item for a Pattern.Any entity.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The Pattern.Any entity extractor ID.
 *
 * @param {number} itemId The explicit list item ID.
 *
 * @param {object} item The new explicit list item.
 *
 * @param {string} [item.explicitListItem] The explicit list item.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _updateExplicitListItem(appId, versionId, entityId, itemId, item, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (itemId === null || itemId === undefined || typeof itemId !== 'number') {
      throw new Error('itemId cannot be null or undefined and it must be of type number.');
    }
    if (item === null || item === undefined) {
      throw new Error('item cannot be null or undefined.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist/{itemId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{itemId}', encodeURIComponent(itemId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'PUT';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  // Serialize Request
  let requestContent = null;
  let requestModel = null;
  try {
    if (item !== null && item !== undefined) {
      let requestModelMapper = new client.models['ExplicitListItemUpdateObject']().mapper();
      requestModel = client.serialize(requestModelMapper, item, 'item');
      requestContent = JSON.stringify(requestModel);
    }
  } catch (error) {
    let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
        `payload - ${JSON.stringify(item, null, 2)}.`);
    return callback(serializationError);
  }
  httpRequest.body = requestContent;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/**
 * @summary Delete the explicit list item from the Pattern.any explicit list.
 *
 * @param {uuid} appId The application ID.
 *
 * @param {string} versionId The version ID.
 *
 * @param {uuid} entityId The pattern.any entity id.
 *
 * @param {number} itemId The explicit list item which will be deleted.
 *
 * @param {object} [options] Optional Parameters.
 *
 * @param {object} [options.customHeaders] Headers that will be added to the
 * request
 *
 * @param {function} callback - The callback.
 *
 * @returns {function} callback(err, result, request, response)
 *
 *                      {Error}  err        - The Error object if an error occurred, null otherwise.
 *
 *                      {object} [result]   - The deserialized result object if an error did not occur.
 *                      See {@link OperationStatus} for more information.
 *
 *                      {object} [request]  - The HTTP Request object if an error did not occur.
 *
 *                      {stream} [response] - The HTTP Response stream if an error did not occur.
 */
function _deleteExplicitListItem(appId, versionId, entityId, itemId, options, callback) {
   /* jshint validthis: true */
  let client = this.client;
  if(!callback && typeof options === 'function') {
    callback = options;
    options = null;
  }
  if (!callback) {
    throw new Error('callback cannot be null.');
  }
  // Validate
  try {
    if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
      throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
    }
    if (appId === null || appId === undefined || typeof appId.valueOf() !== 'string' || !msRest.isValidUuid(appId)) {
      throw new Error('appId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (versionId === null || versionId === undefined || typeof versionId.valueOf() !== 'string') {
      throw new Error('versionId cannot be null or undefined and it must be of type string.');
    }
    if (entityId === null || entityId === undefined || typeof entityId.valueOf() !== 'string' || !msRest.isValidUuid(entityId)) {
      throw new Error('entityId cannot be null or undefined and it must be of type string and must be a valid uuid.');
    }
    if (itemId === null || itemId === undefined || typeof itemId !== 'number') {
      throw new Error('itemId cannot be null or undefined and it must be of type number.');
    }
  } catch (error) {
    return callback(error);
  }

  // Construct URL
  let baseUrl = this.client.baseUri;
  let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'apps/{appId}/versions/{versionId}/patternanyentities/{entityId}/explicitlist/{itemId}';
  requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
  requestUrl = requestUrl.replace('{appId}', encodeURIComponent(appId.toString()));
  requestUrl = requestUrl.replace('{versionId}', encodeURIComponent(versionId));
  requestUrl = requestUrl.replace('{entityId}', encodeURIComponent(entityId.toString()));
  requestUrl = requestUrl.replace('{itemId}', encodeURIComponent(itemId.toString()));

  // Create HTTP transport objects
  let httpRequest = new WebResource();
  httpRequest.method = 'DELETE';
  httpRequest.url = requestUrl;
  httpRequest.headers = {};
  // Set Headers
  httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
  if(options) {
    for(let headerName in options['customHeaders']) {
      if (options['customHeaders'].hasOwnProperty(headerName)) {
        httpRequest.headers[headerName] = options['customHeaders'][headerName];
      }
    }
  }
  httpRequest.body = null;
  // Send Request
  return client.pipeline(httpRequest, (err, response, responseBody) => {
    if (err) {
      return callback(err);
    }
    let statusCode = response.statusCode;
    if (statusCode !== 200) {
      let error = new Error(responseBody);
      error.statusCode = response.statusCode;
      error.request = msRest.stripRequest(httpRequest);
      error.response = msRest.stripResponse(response);
      if (responseBody === '') responseBody = null;
      let parsedErrorResponse;
      try {
        parsedErrorResponse = JSON.parse(responseBody);
        if (parsedErrorResponse) {
          let internalError = null;
          if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
          error.code = internalError ? internalError.code : parsedErrorResponse.code;
          error.message = internalError ? internalError.message : parsedErrorResponse.message;
        }
        if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
          let resultMapper = new client.models['ErrorResponse']().mapper();
          error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
        }
      } catch (defaultError) {
        error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
                         `- "${responseBody}" for the default response.`;
        return callback(error);
      }
      return callback(error);
    }
    // Create Result
    let result = null;
    if (responseBody === '') responseBody = null;
    // Deserialize Response
    if (statusCode === 200) {
      let parsedResponse = null;
      try {
        parsedResponse = JSON.parse(responseBody);
        result = JSON.parse(responseBody);
        if (parsedResponse !== null && parsedResponse !== undefined) {
          let resultMapper = new client.models['OperationStatus']().mapper();
          result = client.deserialize(resultMapper, parsedResponse, 'result');
        }
      } catch (error) {
        let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
        deserializationError.request = msRest.stripRequest(httpRequest);
        deserializationError.response = msRest.stripResponse(response);
        return callback(deserializationError);
      }
    }

    return callback(null, result, httpRequest, response);
  });
}

/** Class representing a Model. */
class Model {
  /**
   * Create a Model.
   * @param {LUISAuthoringClient} client Reference to the service client.
   */
  constructor(client) {
    this.client = client;
    this._addIntent = _addIntent;
    this._listIntents = _listIntents;
    this._addEntity = _addEntity;
    this._listEntities = _listEntities;
    this._addHierarchicalEntity = _addHierarchicalEntity;
    this._listHierarchicalEntities = _listHierarchicalEntities;
    this._addCompositeEntity = _addCompositeEntity;
    this._listCompositeEntities = _listCompositeEntities;
    this._listClosedLists = _listClosedLists;
    this._addClosedList = _addClosedList;
    this._addPrebuilt = _addPrebuilt;
    this._listPrebuilts = _listPrebuilts;
    this._listPrebuiltEntities = _listPrebuiltEntities;
    this._listModels = _listModels;
    this._examplesMethod = _examplesMethod;
    this._getIntent = _getIntent;
    this._updateIntent = _updateIntent;
    this._deleteIntent = _deleteIntent;
    this._getEntity = _getEntity;
    this._updateEntity = _updateEntity;
    this._deleteEntity = _deleteEntity;
    this._getHierarchicalEntity = _getHierarchicalEntity;
    this._updateHierarchicalEntity = _updateHierarchicalEntity;
    this._deleteHierarchicalEntity = _deleteHierarchicalEntity;
    this._getCompositeEntity = _getCompositeEntity;
    this._updateCompositeEntity = _updateCompositeEntity;
    this._deleteCompositeEntity = _deleteCompositeEntity;
    this._getClosedList = _getClosedList;
    this._updateClosedList = _updateClosedList;
    this._patchClosedList = _patchClosedList;
    this._deleteClosedList = _deleteClosedList;
    this._getPrebuilt = _getPrebuilt;
    this._deletePrebuilt = _deletePrebuilt;
    this._deleteSubList = _deleteSubList;
    this._updateSubList = _updateSubList;
    this._getIntentSuggestions = _getIntentSuggestions;
    this._getEntitySuggestions = _getEntitySuggestions;
    this._addSubList = _addSubList;
    this._addCustomPrebuiltDomain = _addCustomPrebuiltDomain;
    this._addCustomPrebuiltIntent = _addCustomPrebuiltIntent;
    this._listCustomPrebuiltIntents = _listCustomPrebuiltIntents;
    this._addCustomPrebuiltEntity = _addCustomPrebuiltEntity;
    this._listCustomPrebuiltEntities = _listCustomPrebuiltEntities;
    this._listCustomPrebuiltModels = _listCustomPrebuiltModels;
    this._deleteCustomPrebuiltDomain = _deleteCustomPrebuiltDomain;
    this._getHierarchicalEntityChild = _getHierarchicalEntityChild;
    this._updateHierarchicalEntityChild = _updateHierarchicalEntityChild;
    this._deleteHierarchicalEntityChild = _deleteHierarchicalEntityChild;
    this._addHierarchicalEntityChild = _addHierarchicalEntityChild;
    this._addCompositeEntityChild = _addCompositeEntityChild;
    this._deleteCompositeEntityChild = _deleteCompositeEntityChild;
    this._getRegexEntityInfos = _getRegexEntityInfos;
    this._createRegexEntityModel = _createRegexEntityModel;
    this._getPatternAnyEntityInfos = _getPatternAnyEntityInfos;
    this._createPatternAnyEntityModel = _createPatternAnyEntityModel;
    this._getEntityRoles = _getEntityRoles;
    this._createEntityRole = _createEntityRole;
    this._getPrebuiltEntityRoles = _getPrebuiltEntityRoles;
    this._createPrebuiltEntityRole = _createPrebuiltEntityRole;
    this._getClosedListEntityRoles = _getClosedListEntityRoles;
    this._createClosedListEntityRole = _createClosedListEntityRole;
    this._getRegexEntityRoles = _getRegexEntityRoles;
    this._createRegexEntityRole = _createRegexEntityRole;
    this._getCompositeEntityRoles = _getCompositeEntityRoles;
    this._createCompositeEntityRole = _createCompositeEntityRole;
    this._getPatternAnyEntityRoles = _getPatternAnyEntityRoles;
    this._createPatternAnyEntityRole = _createPatternAnyEntityRole;
    this._getHierarchicalEntityRoles = _getHierarchicalEntityRoles;
    this._createHierarchicalEntityRole = _createHierarchicalEntityRole;
    this._getCustomPrebuiltEntityRoles = _getCustomPrebuiltEntityRoles;
    this._createCustomPrebuiltEntityRole = _createCustomPrebuiltEntityRole;
    this._getExplicitList = _getExplicitList;
    this._addExplicitListItem = _addExplicitListItem;
    this._getRegexEntityEntityInfo = _getRegexEntityEntityInfo;
    this._updateRegexEntityModel = _updateRegexEntityModel;
    this._deleteRegexEntityModel = _deleteRegexEntityModel;
    this._getPatternAnyEntityInfo = _getPatternAnyEntityInfo;
    this._updatePatternAnyEntityModel = _updatePatternAnyEntityModel;
    this._deletePatternAnyEntityModel = _deletePatternAnyEntityModel;
    this._getEntityRole = _getEntityRole;
    this._updateEntityRole = _updateEntityRole;
    this._deleteEntityRole = _deleteEntityRole;
    this._getPrebuiltEntityRole = _getPrebuiltEntityRole;
    this._updatePrebuiltEntityRole = _updatePrebuiltEntityRole;
    this._deletePrebuiltEntityRole = _deletePrebuiltEntityRole;
    this._getClosedListEntityRole = _getClosedListEntityRole;
    this._updateClosedListEntityRole = _updateClosedListEntityRole;
    this._deleteClosedListEntityRole = _deleteClosedListEntityRole;
    this._getRegexEntityRole = _getRegexEntityRole;
    this._updateRegexEntityRole = _updateRegexEntityRole;
    this._deleteRegexEntityRole = _deleteRegexEntityRole;
    this._getCompositeEntityRole = _getCompositeEntityRole;
    this._updateCompositeEntityRole = _updateCompositeEntityRole;
    this._deleteCompositeEntityRole = _deleteCompositeEntityRole;
    this._getPatternAnyEntityRole = _getPatternAnyEntityRole;
    this._updatePatternAnyEntityRole = _updatePatternAnyEntityRole;
    this._deletePatternAnyEntityRole = _deletePatternAnyEntityRole;
    this._getHierarchicalEntityRole = _getHierarchicalEntityRole;
    this._updateHierarchicalEntityRole = _updateHierarchicalEntityRole;
    this._deleteHierarchicalEntityRole = _deleteHierarchicalEntityRole;
    this._getCustomEntityRole = _getCustomEntityRole;
    this._updateCustomPrebuiltEntityRole = _updateCustomPrebuiltEntityRole;
    this._deleteCustomEntityRole = _deleteCustomEntityRole;
    this._getExplicitListItem = _getExplicitListItem;
    this._updateExplicitListItem = _updateExplicitListItem;
    this._deleteExplicitListItem = _deleteExplicitListItem;
  }

  /**
   * Adds an intent classifier to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} intentCreateObject A model object containing the name of the
   * new intent classifier.
   *
   * @param {string} [intentCreateObject.name] Name of the new entity extractor.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addIntentWithHttpOperationResponse(appId, versionId, intentCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addIntent(appId, versionId, intentCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds an intent classifier to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} intentCreateObject A model object containing the name of the
   * new intent classifier.
   *
   * @param {string} [intentCreateObject.name] Name of the new entity extractor.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addIntent(appId, versionId, intentCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addIntent(appId, versionId, intentCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addIntent(appId, versionId, intentCreateObject, options, optionalCallback);
    }
  }

  /**
   * Gets information about the intent models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listIntentsWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listIntents(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the intent models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listIntents(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listIntents(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listIntents(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Adds an entity extractor to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} modelCreateObject A model object containing the name for the
   * new entity extractor.
   *
   * @param {string} [modelCreateObject.name] Name of the new entity extractor.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addEntityWithHttpOperationResponse(appId, versionId, modelCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addEntity(appId, versionId, modelCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds an entity extractor to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} modelCreateObject A model object containing the name for the
   * new entity extractor.
   *
   * @param {string} [modelCreateObject.name] Name of the new entity extractor.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addEntity(appId, versionId, modelCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addEntity(appId, versionId, modelCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addEntity(appId, versionId, modelCreateObject, options, optionalCallback);
    }
  }

  /**
   * Gets information about the entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listEntitiesWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listEntities(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listEntities(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listEntities(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listEntities(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Adds a hierarchical entity extractor to the application version.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} hierarchicalModelCreateObject A model containing the name
   * and children of the new entity extractor.
   *
   * @param {array} [hierarchicalModelCreateObject.children] Child entities.
   *
   * @param {string} [hierarchicalModelCreateObject.name] Entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addHierarchicalEntityWithHttpOperationResponse(appId, versionId, hierarchicalModelCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addHierarchicalEntity(appId, versionId, hierarchicalModelCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a hierarchical entity extractor to the application version.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} hierarchicalModelCreateObject A model containing the name
   * and children of the new entity extractor.
   *
   * @param {array} [hierarchicalModelCreateObject.children] Child entities.
   *
   * @param {string} [hierarchicalModelCreateObject.name] Entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addHierarchicalEntity(appId, versionId, hierarchicalModelCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addHierarchicalEntity(appId, versionId, hierarchicalModelCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addHierarchicalEntity(appId, versionId, hierarchicalModelCreateObject, options, optionalCallback);
    }
  }

  /**
   * Gets information about the hierarchical entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listHierarchicalEntitiesWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listHierarchicalEntities(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the hierarchical entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listHierarchicalEntities(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listHierarchicalEntities(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listHierarchicalEntities(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Adds a composite entity extractor to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} compositeModelCreateObject A model containing the name and
   * children of the new entity extractor.
   *
   * @param {array} [compositeModelCreateObject.children] Child entities.
   *
   * @param {string} [compositeModelCreateObject.name] Entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addCompositeEntityWithHttpOperationResponse(appId, versionId, compositeModelCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addCompositeEntity(appId, versionId, compositeModelCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a composite entity extractor to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} compositeModelCreateObject A model containing the name and
   * children of the new entity extractor.
   *
   * @param {array} [compositeModelCreateObject.children] Child entities.
   *
   * @param {string} [compositeModelCreateObject.name] Entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addCompositeEntity(appId, versionId, compositeModelCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addCompositeEntity(appId, versionId, compositeModelCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addCompositeEntity(appId, versionId, compositeModelCreateObject, options, optionalCallback);
    }
  }

  /**
   * Gets information about the composite entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listCompositeEntitiesWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listCompositeEntities(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the composite entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listCompositeEntities(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listCompositeEntities(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listCompositeEntities(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Gets information about the closedlist models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listClosedListsWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listClosedLists(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the closedlist models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listClosedLists(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listClosedLists(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listClosedLists(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Adds a closed list model to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} closedListModelCreateObject A model containing the name and
   * words for the new closed list entity extractor.
   *
   * @param {array} [closedListModelCreateObject.subLists] Sublists for the
   * feature.
   *
   * @param {string} [closedListModelCreateObject.name] Name of the closed list
   * feature.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addClosedListWithHttpOperationResponse(appId, versionId, closedListModelCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addClosedList(appId, versionId, closedListModelCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a closed list model to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} closedListModelCreateObject A model containing the name and
   * words for the new closed list entity extractor.
   *
   * @param {array} [closedListModelCreateObject.subLists] Sublists for the
   * feature.
   *
   * @param {string} [closedListModelCreateObject.name] Name of the closed list
   * feature.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addClosedList(appId, versionId, closedListModelCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addClosedList(appId, versionId, closedListModelCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addClosedList(appId, versionId, closedListModelCreateObject, options, optionalCallback);
    }
  }

  /**
   * Adds a list of prebuilt entity extractors to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {array} prebuiltExtractorNames An array of prebuilt entity extractor
   * names.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addPrebuiltWithHttpOperationResponse(appId, versionId, prebuiltExtractorNames, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addPrebuilt(appId, versionId, prebuiltExtractorNames, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a list of prebuilt entity extractors to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {array} prebuiltExtractorNames An array of prebuilt entity extractor
   * names.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addPrebuilt(appId, versionId, prebuiltExtractorNames, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addPrebuilt(appId, versionId, prebuiltExtractorNames, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addPrebuilt(appId, versionId, prebuiltExtractorNames, options, optionalCallback);
    }
  }

  /**
   * Gets information about the prebuilt entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listPrebuiltsWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listPrebuilts(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the prebuilt entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listPrebuilts(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listPrebuilts(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listPrebuilts(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Gets all the available prebuilt entity extractors for the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listPrebuiltEntitiesWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listPrebuiltEntities(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets all the available prebuilt entity extractors for the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listPrebuiltEntities(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listPrebuiltEntities(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listPrebuiltEntities(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Gets information about the application version models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listModelsWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listModels(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the application version models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listModels(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listModels(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listModels(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Gets the utterances for the given model in the given app version.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {string} modelId The ID (GUID) of the model.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  examplesMethodWithHttpOperationResponse(appId, versionId, modelId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._examplesMethod(appId, versionId, modelId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets the utterances for the given model in the given app version.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {string} modelId The ID (GUID) of the model.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  examplesMethod(appId, versionId, modelId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._examplesMethod(appId, versionId, modelId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._examplesMethod(appId, versionId, modelId, options, optionalCallback);
    }
  }

  /**
   * Gets information about the intent model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} intentId The intent classifier ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<IntentClassifier>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getIntentWithHttpOperationResponse(appId, versionId, intentId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getIntent(appId, versionId, intentId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the intent model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} intentId The intent classifier ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {IntentClassifier} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link IntentClassifier} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getIntent(appId, versionId, intentId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getIntent(appId, versionId, intentId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getIntent(appId, versionId, intentId, options, optionalCallback);
    }
  }

  /**
   * Updates the name of an intent classifier.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} intentId The intent classifier ID.
   *
   * @param {object} modelUpdateObject A model object containing the new intent
   * classifier name.
   *
   * @param {string} [modelUpdateObject.name] The entity's new name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateIntentWithHttpOperationResponse(appId, versionId, intentId, modelUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateIntent(appId, versionId, intentId, modelUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates the name of an intent classifier.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} intentId The intent classifier ID.
   *
   * @param {object} modelUpdateObject A model object containing the new intent
   * classifier name.
   *
   * @param {string} [modelUpdateObject.name] The entity's new name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateIntent(appId, versionId, intentId, modelUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateIntent(appId, versionId, intentId, modelUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateIntent(appId, versionId, intentId, modelUpdateObject, options, optionalCallback);
    }
  }

  /**
   * Deletes an intent classifier from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} intentId The intent classifier ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.deleteUtterances] Also delete the intent's
   * utterances (true). Or move the utterances to the None intent (false - the
   * default value).
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteIntentWithHttpOperationResponse(appId, versionId, intentId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteIntent(appId, versionId, intentId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes an intent classifier from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} intentId The intent classifier ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {boolean} [options.deleteUtterances] Also delete the intent's
   * utterances (true). Or move the utterances to the None intent (false - the
   * default value).
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteIntent(appId, versionId, intentId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteIntent(appId, versionId, intentId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteIntent(appId, versionId, intentId, options, optionalCallback);
    }
  }

  /**
   * Gets information about the entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityExtractor>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getEntityWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getEntity(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityExtractor} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityExtractor} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getEntity(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getEntity(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getEntity(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * Updates the name of an entity extractor.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity extractor ID.
   *
   * @param {object} modelUpdateObject A model object containing the new entity
   * extractor name.
   *
   * @param {string} [modelUpdateObject.name] The entity's new name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateEntityWithHttpOperationResponse(appId, versionId, entityId, modelUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateEntity(appId, versionId, entityId, modelUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates the name of an entity extractor.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity extractor ID.
   *
   * @param {object} modelUpdateObject A model object containing the new entity
   * extractor name.
   *
   * @param {string} [modelUpdateObject.name] The entity's new name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateEntity(appId, versionId, entityId, modelUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateEntity(appId, versionId, entityId, modelUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateEntity(appId, versionId, entityId, modelUpdateObject, options, optionalCallback);
    }
  }

  /**
   * Deletes an entity extractor from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteEntityWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteEntity(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes an entity extractor from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteEntity(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteEntity(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteEntity(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * Gets information about the hierarchical entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<HierarchicalEntityExtractor>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getHierarchicalEntityWithHttpOperationResponse(appId, versionId, hEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getHierarchicalEntity(appId, versionId, hEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the hierarchical entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {HierarchicalEntityExtractor} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link HierarchicalEntityExtractor} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getHierarchicalEntity(appId, versionId, hEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getHierarchicalEntity(appId, versionId, hEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getHierarchicalEntity(appId, versionId, hEntityId, options, optionalCallback);
    }
  }

  /**
   * Updates the name and children of a hierarchical entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} hierarchicalModelUpdateObject Model containing names of the
   * children of the hierarchical entity.
   *
   * @param {array} [hierarchicalModelUpdateObject.children] Child entities.
   *
   * @param {string} [hierarchicalModelUpdateObject.name] Entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateHierarchicalEntityWithHttpOperationResponse(appId, versionId, hEntityId, hierarchicalModelUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateHierarchicalEntity(appId, versionId, hEntityId, hierarchicalModelUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates the name and children of a hierarchical entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} hierarchicalModelUpdateObject Model containing names of the
   * children of the hierarchical entity.
   *
   * @param {array} [hierarchicalModelUpdateObject.children] Child entities.
   *
   * @param {string} [hierarchicalModelUpdateObject.name] Entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateHierarchicalEntity(appId, versionId, hEntityId, hierarchicalModelUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateHierarchicalEntity(appId, versionId, hEntityId, hierarchicalModelUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateHierarchicalEntity(appId, versionId, hEntityId, hierarchicalModelUpdateObject, options, optionalCallback);
    }
  }

  /**
   * Deletes a hierarchical entity extractor from the application version.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteHierarchicalEntityWithHttpOperationResponse(appId, versionId, hEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteHierarchicalEntity(appId, versionId, hEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a hierarchical entity extractor from the application version.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteHierarchicalEntity(appId, versionId, hEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteHierarchicalEntity(appId, versionId, hEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteHierarchicalEntity(appId, versionId, hEntityId, options, optionalCallback);
    }
  }

  /**
   * Gets information about the composite entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<CompositeEntityExtractor>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getCompositeEntityWithHttpOperationResponse(appId, versionId, cEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getCompositeEntity(appId, versionId, cEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the composite entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {CompositeEntityExtractor} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link CompositeEntityExtractor} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getCompositeEntity(appId, versionId, cEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getCompositeEntity(appId, versionId, cEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getCompositeEntity(appId, versionId, cEntityId, options, optionalCallback);
    }
  }

  /**
   * Updates the composite entity extractor.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} compositeModelUpdateObject A model object containing the new
   * entity extractor name and children.
   *
   * @param {array} [compositeModelUpdateObject.children] Child entities.
   *
   * @param {string} [compositeModelUpdateObject.name] Entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateCompositeEntityWithHttpOperationResponse(appId, versionId, cEntityId, compositeModelUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateCompositeEntity(appId, versionId, cEntityId, compositeModelUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates the composite entity extractor.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} compositeModelUpdateObject A model object containing the new
   * entity extractor name and children.
   *
   * @param {array} [compositeModelUpdateObject.children] Child entities.
   *
   * @param {string} [compositeModelUpdateObject.name] Entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateCompositeEntity(appId, versionId, cEntityId, compositeModelUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateCompositeEntity(appId, versionId, cEntityId, compositeModelUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateCompositeEntity(appId, versionId, cEntityId, compositeModelUpdateObject, options, optionalCallback);
    }
  }

  /**
   * Deletes a composite entity extractor from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteCompositeEntityWithHttpOperationResponse(appId, versionId, cEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteCompositeEntity(appId, versionId, cEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a composite entity extractor from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteCompositeEntity(appId, versionId, cEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteCompositeEntity(appId, versionId, cEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteCompositeEntity(appId, versionId, cEntityId, options, optionalCallback);
    }
  }

  /**
   * Gets information of a closed list model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list model ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<ClosedListEntityExtractor>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getClosedListWithHttpOperationResponse(appId, versionId, clEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getClosedList(appId, versionId, clEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information of a closed list model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list model ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {ClosedListEntityExtractor} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link ClosedListEntityExtractor} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getClosedList(appId, versionId, clEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getClosedList(appId, versionId, clEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getClosedList(appId, versionId, clEntityId, options, optionalCallback);
    }
  }

  /**
   * Updates the closed list model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list model ID.
   *
   * @param {object} closedListModelUpdateObject The new entity name and words
   * list.
   *
   * @param {array} [closedListModelUpdateObject.subLists] The new sublists for
   * the feature.
   *
   * @param {string} [closedListModelUpdateObject.name] The new name of the
   * closed list feature.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateClosedListWithHttpOperationResponse(appId, versionId, clEntityId, closedListModelUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateClosedList(appId, versionId, clEntityId, closedListModelUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates the closed list model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list model ID.
   *
   * @param {object} closedListModelUpdateObject The new entity name and words
   * list.
   *
   * @param {array} [closedListModelUpdateObject.subLists] The new sublists for
   * the feature.
   *
   * @param {string} [closedListModelUpdateObject.name] The new name of the
   * closed list feature.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateClosedList(appId, versionId, clEntityId, closedListModelUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateClosedList(appId, versionId, clEntityId, closedListModelUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateClosedList(appId, versionId, clEntityId, closedListModelUpdateObject, options, optionalCallback);
    }
  }

  /**
   * Adds a batch of sublists to an existing closedlist.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list model ID.
   *
   * @param {object} closedListModelPatchObject A words list batch.
   *
   * @param {array} [closedListModelPatchObject.subLists] Sublists to add.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  patchClosedListWithHttpOperationResponse(appId, versionId, clEntityId, closedListModelPatchObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._patchClosedList(appId, versionId, clEntityId, closedListModelPatchObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a batch of sublists to an existing closedlist.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list model ID.
   *
   * @param {object} closedListModelPatchObject A words list batch.
   *
   * @param {array} [closedListModelPatchObject.subLists] Sublists to add.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  patchClosedList(appId, versionId, clEntityId, closedListModelPatchObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._patchClosedList(appId, versionId, clEntityId, closedListModelPatchObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._patchClosedList(appId, versionId, clEntityId, closedListModelPatchObject, options, optionalCallback);
    }
  }

  /**
   * Deletes a closed list model from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list model ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteClosedListWithHttpOperationResponse(appId, versionId, clEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteClosedList(appId, versionId, clEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a closed list model from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list model ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteClosedList(appId, versionId, clEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteClosedList(appId, versionId, clEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteClosedList(appId, versionId, clEntityId, options, optionalCallback);
    }
  }

  /**
   * Gets information about the prebuilt entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} prebuiltId The prebuilt entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<PrebuiltEntityExtractor>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getPrebuiltWithHttpOperationResponse(appId, versionId, prebuiltId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPrebuilt(appId, versionId, prebuiltId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the prebuilt entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} prebuiltId The prebuilt entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {PrebuiltEntityExtractor} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link PrebuiltEntityExtractor} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getPrebuilt(appId, versionId, prebuiltId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getPrebuilt(appId, versionId, prebuiltId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPrebuilt(appId, versionId, prebuiltId, options, optionalCallback);
    }
  }

  /**
   * Deletes a prebuilt entity extractor from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} prebuiltId The prebuilt entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deletePrebuiltWithHttpOperationResponse(appId, versionId, prebuiltId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deletePrebuilt(appId, versionId, prebuiltId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a prebuilt entity extractor from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} prebuiltId The prebuilt entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deletePrebuilt(appId, versionId, prebuiltId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deletePrebuilt(appId, versionId, prebuiltId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deletePrebuilt(appId, versionId, prebuiltId, options, optionalCallback);
    }
  }

  /**
   * Deletes a sublist of a specific closed list model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list entity extractor ID.
   *
   * @param {number} subListId The sublist ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteSubListWithHttpOperationResponse(appId, versionId, clEntityId, subListId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteSubList(appId, versionId, clEntityId, subListId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a sublist of a specific closed list model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list entity extractor ID.
   *
   * @param {number} subListId The sublist ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteSubList(appId, versionId, clEntityId, subListId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteSubList(appId, versionId, clEntityId, subListId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteSubList(appId, versionId, clEntityId, subListId, options, optionalCallback);
    }
  }

  /**
   * Updates one of the closed list's sublists.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list entity extractor ID.
   *
   * @param {number} subListId The sublist ID.
   *
   * @param {object} wordListBaseUpdateObject A sublist update object containing
   * the new canonical form and the list of words.
   *
   * @param {string} [wordListBaseUpdateObject.canonicalForm] The standard form
   * that the list represents.
   *
   * @param {array} [wordListBaseUpdateObject.list] List of synonym words.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateSubListWithHttpOperationResponse(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateSubList(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Updates one of the closed list's sublists.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list entity extractor ID.
   *
   * @param {number} subListId The sublist ID.
   *
   * @param {object} wordListBaseUpdateObject A sublist update object containing
   * the new canonical form and the list of words.
   *
   * @param {string} [wordListBaseUpdateObject.canonicalForm] The standard form
   * that the list represents.
   *
   * @param {array} [wordListBaseUpdateObject.list] List of synonym words.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateSubList(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateSubList(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateSubList(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject, options, optionalCallback);
    }
  }

  /**
   * Suggests examples that would improve the accuracy of the intent model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} intentId The intent classifier ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getIntentSuggestionsWithHttpOperationResponse(appId, versionId, intentId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getIntentSuggestions(appId, versionId, intentId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Suggests examples that would improve the accuracy of the intent model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} intentId The intent classifier ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getIntentSuggestions(appId, versionId, intentId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getIntentSuggestions(appId, versionId, intentId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getIntentSuggestions(appId, versionId, intentId, options, optionalCallback);
    }
  }

  /**
   * Get suggestion examples that would improve the accuracy of the entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The target entity extractor model to enhance.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getEntitySuggestionsWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getEntitySuggestions(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Get suggestion examples that would improve the accuracy of the entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The target entity extractor model to enhance.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getEntitySuggestions(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getEntitySuggestions(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getEntitySuggestions(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * Adds a list to an existing closed list.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list entity extractor ID.
   *
   * @param {object} wordListCreateObject Words list.
   *
   * @param {string} [wordListCreateObject.canonicalForm] The standard form that
   * the list represents.
   *
   * @param {array} [wordListCreateObject.list] List of synonym words.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Number>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addSubListWithHttpOperationResponse(appId, versionId, clEntityId, wordListCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addSubList(appId, versionId, clEntityId, wordListCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a list to an existing closed list.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} clEntityId The closed list entity extractor ID.
   *
   * @param {object} wordListCreateObject Words list.
   *
   * @param {string} [wordListCreateObject.canonicalForm] The standard form that
   * the list represents.
   *
   * @param {array} [wordListCreateObject.list] List of synonym words.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Number} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {number} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addSubList(appId, versionId, clEntityId, wordListCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addSubList(appId, versionId, clEntityId, wordListCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addSubList(appId, versionId, clEntityId, wordListCreateObject, options, optionalCallback);
    }
  }

  /**
   * Adds a customizable prebuilt domain along with all of its models to this
   * application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} prebuiltDomainObject A prebuilt domain create object
   * containing the name of the domain.
   *
   * @param {string} [prebuiltDomainObject.domainName] The domain name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addCustomPrebuiltDomainWithHttpOperationResponse(appId, versionId, prebuiltDomainObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addCustomPrebuiltDomain(appId, versionId, prebuiltDomainObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a customizable prebuilt domain along with all of its models to this
   * application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} prebuiltDomainObject A prebuilt domain create object
   * containing the name of the domain.
   *
   * @param {string} [prebuiltDomainObject.domainName] The domain name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addCustomPrebuiltDomain(appId, versionId, prebuiltDomainObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addCustomPrebuiltDomain(appId, versionId, prebuiltDomainObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addCustomPrebuiltDomain(appId, versionId, prebuiltDomainObject, options, optionalCallback);
    }
  }

  /**
   * Adds a custom prebuilt intent model to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} prebuiltDomainModelCreateObject A model object containing
   * the name of the custom prebuilt intent and the name of the domain to which
   * this model belongs.
   *
   * @param {string} [prebuiltDomainModelCreateObject.domainName] The domain
   * name.
   *
   * @param {string} [prebuiltDomainModelCreateObject.modelName] The intent name
   * or entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addCustomPrebuiltIntentWithHttpOperationResponse(appId, versionId, prebuiltDomainModelCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addCustomPrebuiltIntent(appId, versionId, prebuiltDomainModelCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a custom prebuilt intent model to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} prebuiltDomainModelCreateObject A model object containing
   * the name of the custom prebuilt intent and the name of the domain to which
   * this model belongs.
   *
   * @param {string} [prebuiltDomainModelCreateObject.domainName] The domain
   * name.
   *
   * @param {string} [prebuiltDomainModelCreateObject.modelName] The intent name
   * or entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addCustomPrebuiltIntent(appId, versionId, prebuiltDomainModelCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addCustomPrebuiltIntent(appId, versionId, prebuiltDomainModelCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addCustomPrebuiltIntent(appId, versionId, prebuiltDomainModelCreateObject, options, optionalCallback);
    }
  }

  /**
   * Gets custom prebuilt intents information of this application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listCustomPrebuiltIntentsWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listCustomPrebuiltIntents(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets custom prebuilt intents information of this application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listCustomPrebuiltIntents(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listCustomPrebuiltIntents(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listCustomPrebuiltIntents(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Adds a custom prebuilt entity model to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} prebuiltDomainModelCreateObject A model object containing
   * the name of the custom prebuilt entity and the name of the domain to which
   * this model belongs.
   *
   * @param {string} [prebuiltDomainModelCreateObject.domainName] The domain
   * name.
   *
   * @param {string} [prebuiltDomainModelCreateObject.modelName] The intent name
   * or entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addCustomPrebuiltEntityWithHttpOperationResponse(appId, versionId, prebuiltDomainModelCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addCustomPrebuiltEntity(appId, versionId, prebuiltDomainModelCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Adds a custom prebuilt entity model to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} prebuiltDomainModelCreateObject A model object containing
   * the name of the custom prebuilt entity and the name of the domain to which
   * this model belongs.
   *
   * @param {string} [prebuiltDomainModelCreateObject.domainName] The domain
   * name.
   *
   * @param {string} [prebuiltDomainModelCreateObject.modelName] The intent name
   * or entity name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addCustomPrebuiltEntity(appId, versionId, prebuiltDomainModelCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addCustomPrebuiltEntity(appId, versionId, prebuiltDomainModelCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addCustomPrebuiltEntity(appId, versionId, prebuiltDomainModelCreateObject, options, optionalCallback);
    }
  }

  /**
   * Gets all custom prebuilt entities information of this application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listCustomPrebuiltEntitiesWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listCustomPrebuiltEntities(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets all custom prebuilt entities information of this application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listCustomPrebuiltEntities(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listCustomPrebuiltEntities(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listCustomPrebuiltEntities(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Gets all custom prebuilt models information of this application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  listCustomPrebuiltModelsWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._listCustomPrebuiltModels(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets all custom prebuilt models information of this application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  listCustomPrebuiltModels(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._listCustomPrebuiltModels(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._listCustomPrebuiltModels(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * Deletes a prebuilt domain's models from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {string} domainName Domain name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteCustomPrebuiltDomainWithHttpOperationResponse(appId, versionId, domainName, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteCustomPrebuiltDomain(appId, versionId, domainName, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a prebuilt domain's models from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {string} domainName Domain name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteCustomPrebuiltDomain(appId, versionId, domainName, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteCustomPrebuiltDomain(appId, versionId, domainName, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteCustomPrebuiltDomain(appId, versionId, domainName, options, optionalCallback);
    }
  }

  /**
   * Gets information about the hierarchical entity child model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} hChildId The hierarchical entity extractor child ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<HierarchicalChildEntity>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getHierarchicalEntityChildWithHttpOperationResponse(appId, versionId, hEntityId, hChildId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Gets information about the hierarchical entity child model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} hChildId The hierarchical entity extractor child ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {HierarchicalChildEntity} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link HierarchicalChildEntity} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, optionalCallback);
    }
  }

  /**
   * Renames a single child in an existing hierarchical entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} hChildId The hierarchical entity extractor child ID.
   *
   * @param {object} hierarchicalChildModelUpdateObject Model object containing
   * new name of the hierarchical entity child.
   *
   * @param {string} [hierarchicalChildModelUpdateObject.name]
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateHierarchicalEntityChildWithHttpOperationResponse(appId, versionId, hEntityId, hChildId, hierarchicalChildModelUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, hierarchicalChildModelUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Renames a single child in an existing hierarchical entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} hChildId The hierarchical entity extractor child ID.
   *
   * @param {object} hierarchicalChildModelUpdateObject Model object containing
   * new name of the hierarchical entity child.
   *
   * @param {string} [hierarchicalChildModelUpdateObject.name]
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, hierarchicalChildModelUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, hierarchicalChildModelUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, hierarchicalChildModelUpdateObject, options, optionalCallback);
    }
  }

  /**
   * Deletes a hierarchical entity extractor child from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} hChildId The hierarchical entity extractor child ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteHierarchicalEntityChildWithHttpOperationResponse(appId, versionId, hEntityId, hChildId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a hierarchical entity extractor child from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} hChildId The hierarchical entity extractor child ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteHierarchicalEntityChild(appId, versionId, hEntityId, hChildId, options, optionalCallback);
    }
  }

  /**
   * Creates a single child in an existing hierarchical entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} hierarchicalChildModelCreateObject A model object containing
   * the name of the new hierarchical child model.
   *
   * @param {string} [hierarchicalChildModelCreateObject.name]
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addHierarchicalEntityChildWithHttpOperationResponse(appId, versionId, hEntityId, hierarchicalChildModelCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addHierarchicalEntityChild(appId, versionId, hEntityId, hierarchicalChildModelCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Creates a single child in an existing hierarchical entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} hierarchicalChildModelCreateObject A model object containing
   * the name of the new hierarchical child model.
   *
   * @param {string} [hierarchicalChildModelCreateObject.name]
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addHierarchicalEntityChild(appId, versionId, hEntityId, hierarchicalChildModelCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addHierarchicalEntityChild(appId, versionId, hEntityId, hierarchicalChildModelCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addHierarchicalEntityChild(appId, versionId, hEntityId, hierarchicalChildModelCreateObject, options, optionalCallback);
    }
  }

  /**
   * Creates a single child in an existing composite entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} compositeChildModelCreateObject A model object containing
   * the name of the new composite child model.
   *
   * @param {string} [compositeChildModelCreateObject.name]
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addCompositeEntityChildWithHttpOperationResponse(appId, versionId, cEntityId, compositeChildModelCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addCompositeEntityChild(appId, versionId, cEntityId, compositeChildModelCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Creates a single child in an existing composite entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} compositeChildModelCreateObject A model object containing
   * the name of the new composite child model.
   *
   * @param {string} [compositeChildModelCreateObject.name]
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addCompositeEntityChild(appId, versionId, cEntityId, compositeChildModelCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addCompositeEntityChild(appId, versionId, cEntityId, compositeChildModelCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addCompositeEntityChild(appId, versionId, cEntityId, compositeChildModelCreateObject, options, optionalCallback);
    }
  }

  /**
   * Deletes a composite entity extractor child from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {uuid} cChildId The hierarchical entity extractor child ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteCompositeEntityChildWithHttpOperationResponse(appId, versionId, cEntityId, cChildId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteCompositeEntityChild(appId, versionId, cEntityId, cChildId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * Deletes a composite entity extractor child from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {uuid} cChildId The hierarchical entity extractor child ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteCompositeEntityChild(appId, versionId, cEntityId, cChildId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteCompositeEntityChild(appId, versionId, cEntityId, cChildId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteCompositeEntityChild(appId, versionId, cEntityId, cChildId, options, optionalCallback);
    }
  }

  /**
   * @summary Gets information about the regex entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getRegexEntityInfosWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getRegexEntityInfos(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Gets information about the regex entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getRegexEntityInfos(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getRegexEntityInfos(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getRegexEntityInfos(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * @summary Adds a regex entity model to the application version.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} regexEntityExtractorCreateObj A model object containing the
   * name and regex pattern for the new regex entity extractor.
   *
   * @param {string} [regexEntityExtractorCreateObj.regexPattern] The regex
   * entity pattern.
   *
   * @param {string} [regexEntityExtractorCreateObj.name] The model name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createRegexEntityModelWithHttpOperationResponse(appId, versionId, regexEntityExtractorCreateObj, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createRegexEntityModel(appId, versionId, regexEntityExtractorCreateObj, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Adds a regex entity model to the application version.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} regexEntityExtractorCreateObj A model object containing the
   * name and regex pattern for the new regex entity extractor.
   *
   * @param {string} [regexEntityExtractorCreateObj.regexPattern] The regex
   * entity pattern.
   *
   * @param {string} [regexEntityExtractorCreateObj.name] The model name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createRegexEntityModel(appId, versionId, regexEntityExtractorCreateObj, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createRegexEntityModel(appId, versionId, regexEntityExtractorCreateObj, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createRegexEntityModel(appId, versionId, regexEntityExtractorCreateObj, options, optionalCallback);
    }
  }

  /**
   * @summary Get information about the Pattern.Any entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getPatternAnyEntityInfosWithHttpOperationResponse(appId, versionId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPatternAnyEntityInfos(appId, versionId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get information about the Pattern.Any entity models.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {number} [options.skip] The number of entries to skip. Default value
   * is 0.
   *
   * @param {number} [options.take] The number of entries to return. Maximum page
   * size is 500. Default is 100.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getPatternAnyEntityInfos(appId, versionId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getPatternAnyEntityInfos(appId, versionId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPatternAnyEntityInfos(appId, versionId, options, optionalCallback);
    }
  }

  /**
   * @summary Adds a pattern.any entity extractor to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} extractorCreateObject A model object containing the name and
   * explicit list for the new Pattern.Any entity extractor.
   *
   * @param {string} [extractorCreateObject.name] The model name.
   *
   * @param {array} [extractorCreateObject.explicitList] The Pattern.Any explicit
   * list.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createPatternAnyEntityModelWithHttpOperationResponse(appId, versionId, extractorCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createPatternAnyEntityModel(appId, versionId, extractorCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Adds a pattern.any entity extractor to the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {object} extractorCreateObject A model object containing the name and
   * explicit list for the new Pattern.Any entity extractor.
   *
   * @param {string} [extractorCreateObject.name] The model name.
   *
   * @param {array} [extractorCreateObject.explicitList] The Pattern.Any explicit
   * list.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createPatternAnyEntityModel(appId, versionId, extractorCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createPatternAnyEntityModel(appId, versionId, extractorCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createPatternAnyEntityModel(appId, versionId, extractorCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getEntityRolesWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getEntityRoles(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getEntityRoles(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createEntityRoleWithHttpOperationResponse(appId, versionId, entityId, entityRoleCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getPrebuiltEntityRolesWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPrebuiltEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getPrebuiltEntityRoles(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getPrebuiltEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPrebuiltEntityRoles(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createPrebuiltEntityRoleWithHttpOperationResponse(appId, versionId, entityId, entityRoleCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getClosedListEntityRolesWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getClosedListEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getClosedListEntityRoles(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getClosedListEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getClosedListEntityRoles(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createClosedListEntityRoleWithHttpOperationResponse(appId, versionId, entityId, entityRoleCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createClosedListEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createClosedListEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createClosedListEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createClosedListEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getRegexEntityRolesWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getRegexEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getRegexEntityRoles(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getRegexEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getRegexEntityRoles(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createRegexEntityRoleWithHttpOperationResponse(appId, versionId, entityId, entityRoleCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createRegexEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createRegexEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createRegexEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createRegexEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getCompositeEntityRolesWithHttpOperationResponse(appId, versionId, cEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getCompositeEntityRoles(appId, versionId, cEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getCompositeEntityRoles(appId, versionId, cEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getCompositeEntityRoles(appId, versionId, cEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getCompositeEntityRoles(appId, versionId, cEntityId, options, optionalCallback);
    }
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createCompositeEntityRoleWithHttpOperationResponse(appId, versionId, cEntityId, entityRoleCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createCompositeEntityRole(appId, versionId, cEntityId, entityRoleCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createCompositeEntityRole(appId, versionId, cEntityId, entityRoleCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createCompositeEntityRole(appId, versionId, cEntityId, entityRoleCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createCompositeEntityRole(appId, versionId, cEntityId, entityRoleCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getPatternAnyEntityRolesWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPatternAnyEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getPatternAnyEntityRoles(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getPatternAnyEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPatternAnyEntityRoles(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createPatternAnyEntityRoleWithHttpOperationResponse(appId, versionId, entityId, entityRoleCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createPatternAnyEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createPatternAnyEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createPatternAnyEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createPatternAnyEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getHierarchicalEntityRolesWithHttpOperationResponse(appId, versionId, hEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getHierarchicalEntityRoles(appId, versionId, hEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getHierarchicalEntityRoles(appId, versionId, hEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getHierarchicalEntityRoles(appId, versionId, hEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getHierarchicalEntityRoles(appId, versionId, hEntityId, options, optionalCallback);
    }
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createHierarchicalEntityRoleWithHttpOperationResponse(appId, versionId, hEntityId, entityRoleCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createHierarchicalEntityRole(appId, versionId, hEntityId, entityRoleCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createHierarchicalEntityRole(appId, versionId, hEntityId, entityRoleCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createHierarchicalEntityRole(appId, versionId, hEntityId, entityRoleCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createHierarchicalEntityRole(appId, versionId, hEntityId, entityRoleCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getCustomPrebuiltEntityRolesWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getCustomPrebuiltEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get All Entity Roles for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity Id
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getCustomPrebuiltEntityRoles(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getCustomPrebuiltEntityRoles(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getCustomPrebuiltEntityRoles(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Uuid>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  createCustomPrebuiltEntityRoleWithHttpOperationResponse(appId, versionId, entityId, entityRoleCreateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._createCustomPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Create an entity role for an entity in the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity model ID.
   *
   * @param {object} entityRoleCreateObject An entity role object containing the
   * name of role.
   *
   * @param {string} [entityRoleCreateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Uuid} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {uuid} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  createCustomPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._createCustomPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._createCustomPrebuiltEntityRole(appId, versionId, entityId, entityRoleCreateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Get the explicit list of the pattern.any entity.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Array>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getExplicitListWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getExplicitList(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get the explicit list of the pattern.any entity.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Array} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {array} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getExplicitList(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getExplicitList(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getExplicitList(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Add a new item to the explicit list for the Pattern.Any entity.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity extractor ID.
   *
   * @param {object} item The new explicit list item.
   *
   * @param {string} [item.explicitListItem] The explicit list item.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<Number>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  addExplicitListItemWithHttpOperationResponse(appId, versionId, entityId, item, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._addExplicitListItem(appId, versionId, entityId, item, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Add a new item to the explicit list for the Pattern.Any entity.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity extractor ID.
   *
   * @param {object} item The new explicit list item.
   *
   * @param {string} [item.explicitListItem] The explicit list item.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {Number} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {number} [result]   - The deserialized result object if an error did not occur.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  addExplicitListItem(appId, versionId, entityId, item, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._addExplicitListItem(appId, versionId, entityId, item, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._addExplicitListItem(appId, versionId, entityId, item, options, optionalCallback);
    }
  }

  /**
   * @summary Gets information of a regex entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} regexEntityId The regex entity model ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<RegexEntityExtractor>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getRegexEntityEntityInfoWithHttpOperationResponse(appId, versionId, regexEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getRegexEntityEntityInfo(appId, versionId, regexEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Gets information of a regex entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} regexEntityId The regex entity model ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {RegexEntityExtractor} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link RegexEntityExtractor} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getRegexEntityEntityInfo(appId, versionId, regexEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getRegexEntityEntityInfo(appId, versionId, regexEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getRegexEntityEntityInfo(appId, versionId, regexEntityId, options, optionalCallback);
    }
  }

  /**
   * @summary Updates the regex entity model .
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} regexEntityId The regex entity extractor ID.
   *
   * @param {object} regexEntityUpdateObject An object containing the new entity
   * name and regex pattern.
   *
   * @param {string} [regexEntityUpdateObject.regexPattern] The regex entity
   * pattern.
   *
   * @param {string} [regexEntityUpdateObject.name] The model name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateRegexEntityModelWithHttpOperationResponse(appId, versionId, regexEntityId, regexEntityUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateRegexEntityModel(appId, versionId, regexEntityId, regexEntityUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Updates the regex entity model .
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} regexEntityId The regex entity extractor ID.
   *
   * @param {object} regexEntityUpdateObject An object containing the new entity
   * name and regex pattern.
   *
   * @param {string} [regexEntityUpdateObject.regexPattern] The regex entity
   * pattern.
   *
   * @param {string} [regexEntityUpdateObject.name] The model name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateRegexEntityModel(appId, versionId, regexEntityId, regexEntityUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateRegexEntityModel(appId, versionId, regexEntityId, regexEntityUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateRegexEntityModel(appId, versionId, regexEntityId, regexEntityUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Deletes a regex entity model from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} regexEntityId The regex entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteRegexEntityModelWithHttpOperationResponse(appId, versionId, regexEntityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteRegexEntityModel(appId, versionId, regexEntityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Deletes a regex entity model from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} regexEntityId The regex entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteRegexEntityModel(appId, versionId, regexEntityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteRegexEntityModel(appId, versionId, regexEntityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteRegexEntityModel(appId, versionId, regexEntityId, options, optionalCallback);
    }
  }

  /**
   * @summary Gets information about the application version's Pattern.Any model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<PatternAnyEntityExtractor>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getPatternAnyEntityInfoWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPatternAnyEntityInfo(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Gets information about the application version's Pattern.Any model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {PatternAnyEntityExtractor} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link PatternAnyEntityExtractor} for more
   *                      information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getPatternAnyEntityInfo(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getPatternAnyEntityInfo(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPatternAnyEntityInfo(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Updates the name and explicit list of a Pattern.Any entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity extractor ID.
   *
   * @param {object} patternAnyUpdateObject An object containing the explicit
   * list of the Pattern.Any entity.
   *
   * @param {string} [patternAnyUpdateObject.name] The model name.
   *
   * @param {array} [patternAnyUpdateObject.explicitList] The Pattern.Any
   * explicit list.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updatePatternAnyEntityModelWithHttpOperationResponse(appId, versionId, entityId, patternAnyUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updatePatternAnyEntityModel(appId, versionId, entityId, patternAnyUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Updates the name and explicit list of a Pattern.Any entity model.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity extractor ID.
   *
   * @param {object} patternAnyUpdateObject An object containing the explicit
   * list of the Pattern.Any entity.
   *
   * @param {string} [patternAnyUpdateObject.name] The model name.
   *
   * @param {array} [patternAnyUpdateObject.explicitList] The Pattern.Any
   * explicit list.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updatePatternAnyEntityModel(appId, versionId, entityId, patternAnyUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updatePatternAnyEntityModel(appId, versionId, entityId, patternAnyUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updatePatternAnyEntityModel(appId, versionId, entityId, patternAnyUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Deletes a Pattern.Any entity extractor from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deletePatternAnyEntityModelWithHttpOperationResponse(appId, versionId, entityId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deletePatternAnyEntityModel(appId, versionId, entityId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Deletes a Pattern.Any entity extractor from the application.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity extractor ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deletePatternAnyEntityModel(appId, versionId, entityId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deletePatternAnyEntityModel(appId, versionId, entityId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deletePatternAnyEntityModel(appId, versionId, entityId, options, optionalCallback);
    }
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityRole>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityRole} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityRole} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, entityRoleUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityRole>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getPrebuiltEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPrebuiltEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityRole} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityRole} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getPrebuiltEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getPrebuiltEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPrebuiltEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updatePrebuiltEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, entityRoleUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updatePrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updatePrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updatePrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updatePrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deletePrebuiltEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deletePrebuiltEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deletePrebuiltEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deletePrebuiltEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deletePrebuiltEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityRole>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getClosedListEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getClosedListEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityRole} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityRole} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getClosedListEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getClosedListEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getClosedListEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateClosedListEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, entityRoleUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateClosedListEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateClosedListEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateClosedListEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateClosedListEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteClosedListEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteClosedListEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteClosedListEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteClosedListEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteClosedListEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityRole>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getRegexEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getRegexEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityRole} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityRole} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getRegexEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getRegexEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getRegexEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateRegexEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, entityRoleUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateRegexEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateRegexEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateRegexEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateRegexEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteRegexEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteRegexEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteRegexEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteRegexEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteRegexEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityRole>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getCompositeEntityRoleWithHttpOperationResponse(appId, versionId, cEntityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getCompositeEntityRole(appId, versionId, cEntityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityRole} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityRole} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getCompositeEntityRole(appId, versionId, cEntityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getCompositeEntityRole(appId, versionId, cEntityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getCompositeEntityRole(appId, versionId, cEntityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateCompositeEntityRoleWithHttpOperationResponse(appId, versionId, cEntityId, roleId, entityRoleUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateCompositeEntityRole(appId, versionId, cEntityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateCompositeEntityRole(appId, versionId, cEntityId, roleId, entityRoleUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateCompositeEntityRole(appId, versionId, cEntityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateCompositeEntityRole(appId, versionId, cEntityId, roleId, entityRoleUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteCompositeEntityRoleWithHttpOperationResponse(appId, versionId, cEntityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteCompositeEntityRole(appId, versionId, cEntityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} cEntityId The composite entity extractor ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteCompositeEntityRole(appId, versionId, cEntityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteCompositeEntityRole(appId, versionId, cEntityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteCompositeEntityRole(appId, versionId, cEntityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityRole>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getPatternAnyEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getPatternAnyEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityRole} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityRole} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getPatternAnyEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getPatternAnyEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getPatternAnyEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updatePatternAnyEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, entityRoleUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updatePatternAnyEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updatePatternAnyEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updatePatternAnyEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updatePatternAnyEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deletePatternAnyEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deletePatternAnyEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deletePatternAnyEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deletePatternAnyEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deletePatternAnyEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityRole>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getHierarchicalEntityRoleWithHttpOperationResponse(appId, versionId, hEntityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityRole} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityRole} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateHierarchicalEntityRoleWithHttpOperationResponse(appId, versionId, hEntityId, roleId, entityRoleUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateHierarchicalEntityRole(appId, versionId, hEntityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateHierarchicalEntityRole(appId, versionId, hEntityId, roleId, entityRoleUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateHierarchicalEntityRole(appId, versionId, hEntityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateHierarchicalEntityRole(appId, versionId, hEntityId, roleId, entityRoleUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteHierarchicalEntityRoleWithHttpOperationResponse(appId, versionId, hEntityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} hEntityId The hierarchical entity extractor ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteHierarchicalEntityRole(appId, versionId, hEntityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<EntityRole>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getCustomEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getCustomEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get one entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId entity ID.
   *
   * @param {uuid} roleId entity role ID.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {EntityRole} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link EntityRole} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getCustomEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getCustomEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getCustomEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateCustomPrebuiltEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, entityRoleUpdateObject, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateCustomPrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Update an entity role for a given entity
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role ID.
   *
   * @param {object} entityRoleUpdateObject The new entity role.
   *
   * @param {string} [entityRoleUpdateObject.name] The entity role name.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateCustomPrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateCustomPrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateCustomPrebuiltEntityRole(appId, versionId, entityId, roleId, entityRoleUpdateObject, options, optionalCallback);
    }
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteCustomEntityRoleWithHttpOperationResponse(appId, versionId, entityId, roleId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteCustomEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete an entity role.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The entity ID.
   *
   * @param {uuid} roleId The entity role Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteCustomEntityRole(appId, versionId, entityId, roleId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteCustomEntityRole(appId, versionId, entityId, roleId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteCustomEntityRole(appId, versionId, entityId, roleId, options, optionalCallback);
    }
  }

  /**
   * @summary Get the explicit list of the pattern.any entity.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity Id.
   *
   * @param {number} itemId The explicit list item Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<ExplicitListItem>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  getExplicitListItemWithHttpOperationResponse(appId, versionId, entityId, itemId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._getExplicitListItem(appId, versionId, entityId, itemId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Get the explicit list of the pattern.any entity.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity Id.
   *
   * @param {number} itemId The explicit list item Id.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {ExplicitListItem} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link ExplicitListItem} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  getExplicitListItem(appId, versionId, entityId, itemId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._getExplicitListItem(appId, versionId, entityId, itemId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._getExplicitListItem(appId, versionId, entityId, itemId, options, optionalCallback);
    }
  }

  /**
   * @summary Updates an explicit list item for a Pattern.Any entity.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity extractor ID.
   *
   * @param {number} itemId The explicit list item ID.
   *
   * @param {object} item The new explicit list item.
   *
   * @param {string} [item.explicitListItem] The explicit list item.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  updateExplicitListItemWithHttpOperationResponse(appId, versionId, entityId, itemId, item, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._updateExplicitListItem(appId, versionId, entityId, itemId, item, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Updates an explicit list item for a Pattern.Any entity.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The Pattern.Any entity extractor ID.
   *
   * @param {number} itemId The explicit list item ID.
   *
   * @param {object} item The new explicit list item.
   *
   * @param {string} [item.explicitListItem] The explicit list item.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  updateExplicitListItem(appId, versionId, entityId, itemId, item, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._updateExplicitListItem(appId, versionId, entityId, itemId, item, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._updateExplicitListItem(appId, versionId, entityId, itemId, item, options, optionalCallback);
    }
  }

  /**
   * @summary Delete the explicit list item from the Pattern.any explicit list.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The pattern.any entity id.
   *
   * @param {number} itemId The explicit list item which will be deleted.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @returns {Promise} A promise is returned
   *
   * @resolve {HttpOperationResponse<OperationStatus>} - The deserialized result object.
   *
   * @reject {Error} - The error object.
   */
  deleteExplicitListItemWithHttpOperationResponse(appId, versionId, entityId, itemId, options) {
    let client = this.client;
    let self = this;
    return new Promise((resolve, reject) => {
      self._deleteExplicitListItem(appId, versionId, entityId, itemId, options, (err, result, request, response) => {
        let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
        httpOperationResponse.body = result;
        if (err) { reject(err); }
        else { resolve(httpOperationResponse); }
        return;
      });
    });
  }

  /**
   * @summary Delete the explicit list item from the Pattern.any explicit list.
   *
   * @param {uuid} appId The application ID.
   *
   * @param {string} versionId The version ID.
   *
   * @param {uuid} entityId The pattern.any entity id.
   *
   * @param {number} itemId The explicit list item which will be deleted.
   *
   * @param {object} [options] Optional Parameters.
   *
   * @param {object} [options.customHeaders] Headers that will be added to the
   * request
   *
   * @param {function} [optionalCallback] - The optional callback.
   *
   * @returns {function|Promise} If a callback was passed as the last parameter
   * then it returns the callback else returns a Promise.
   *
   * {Promise} A promise is returned
   *
   *                      @resolve {OperationStatus} - The deserialized result object.
   *
   *                      @reject {Error} - The error object.
   *
   * {function} optionalCallback(err, result, request, response)
   *
   *                      {Error}  err        - The Error object if an error occurred, null otherwise.
   *
   *                      {object} [result]   - The deserialized result object if an error did not occur.
   *                      See {@link OperationStatus} for more information.
   *
   *                      {object} [request]  - The HTTP Request object if an error did not occur.
   *
   *                      {stream} [response] - The HTTP Response stream if an error did not occur.
   */
  deleteExplicitListItem(appId, versionId, entityId, itemId, options, optionalCallback) {
    let client = this.client;
    let self = this;
    if (!optionalCallback && typeof options === 'function') {
      optionalCallback = options;
      options = null;
    }
    if (!optionalCallback) {
      return new Promise((resolve, reject) => {
        self._deleteExplicitListItem(appId, versionId, entityId, itemId, options, (err, result, request, response) => {
          if (err) { reject(err); }
          else { resolve(result); }
          return;
        });
      });
    } else {
      return self._deleteExplicitListItem(appId, versionId, entityId, itemId, options, optionalCallback);
    }
  }

}

module.exports = Model;
