text: /**
   * DocuSign REST API
   * The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
   *
   * OpenAPI spec version: v2.1
   * Contact: devcenter@docusign.com
   *
   * NOTE: This class is auto generated. Do not edit the class manually and submit a new issue instead.
   *
   */
  
  (function(root, factory) {
    if (typeof define === 'function' && define.amd) {
      // AMD. Register as an anonymous module.
  	define(['Configuration', 'ApiClient', 'model/CommentHistoryResult', 'model/CommentsPublish', 'model/ErrorDetails'], factory);
    } else if (typeof module === 'object' && module.exports) {
      // CommonJS-like environments that support module.exports, like Node.
      module.exports = factory(require('../Configuration'), require('../ApiClient'), require('../model/CommentHistoryResult'), require('../model/CommentsPublish'), require('../model/ErrorDetails'));
    } else {
      // Browser globals (root is window)
      if (!root.Docusign) {
        root.Docusign = {};
      }
      root.Docusign.CommentsApi = factory(root.Docusign.Configuration, root.Docusign.ApiClient, root.Docusign.CommentHistoryResult, root.Docusign.CommentsPublish, root.Docusign.ErrorDetails);
    }
  }(this, function(Configuration, ApiClient, CommentHistoryResult, CommentsPublish, ErrorDetails) {
    'use strict';
  
    /**
     * Comments service.
     * @module api/CommentsApi
     * @version 3.0.0
     */
  
    /**
     * Constructs a new CommentsApi. 
     * @alias module:api/CommentsApi
     * @class
     * @param {module:ApiClient} apiClient Optional API client implementation to use,
     * default to {@link module:ApiClient#instance} if unspecified.
     */
    var exports = function(apiClient) {
      this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;
  
  
      this.setApiClient = function(apiClient) {
        this.apiClient = apiClient;
      };
  
      this.getApiClient = function() {
        return this.apiClient;
      };
  
  
      /**
       * (Optional)Callback function to receive the result of the createEnvelopeComments operation. If none specified a Promise will be returned.
       * @callback module:api/CommentsApi~createEnvelopeCommentsCallback
       * @param {String} error Error message, if any.
       * @param {module:model/CommentHistoryResult} data The data returned by the service call.
       * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.
       */
  
      /**
       * Posts a list of comments for authorized user
       * @param {String} accountId The external account number (int) or account ID Guid.
       * @param {String} envelopeId The envelopeId Guid of the envelope being accessed.
       * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.
       * @param {module:model/CommentsPublish} optsOrCallback.commentsPublish 
       * @param {module:api/CommentsApi~createEnvelopeCommentsCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link module:model/CommentHistoryResult}
       */
      this.createEnvelopeComments = function(accountId, envelopeId, optsOrCallback, callback) {
        optsOrCallback = optsOrCallback || {};
  
        if (typeof optsOrCallback === 'function') {
          callback = optsOrCallback;
          optsOrCallback = {};
        }
  
        var postBody = optsOrCallback['commentsPublish'];
  
        // verify the required parameter 'accountId' is set
        if (accountId == undefined || accountId == null) {
          throw new Error("Missing the required parameter 'accountId' when calling createEnvelopeComments");
        }
  
        // verify the required parameter 'envelopeId' is set
        if (envelopeId == undefined || envelopeId == null) {
          throw new Error("Missing the required parameter 'envelopeId' when calling createEnvelopeComments");
        }
  
        if (typeof callback !== 'function' &&  arguments.length && typeof arguments[arguments.length-1] === 'function'){
          if (typeof optsOrCallback !== 'undefined') {
            optsOrCallback = callback;
          }
          callback = arguments[arguments.length-1];
        }
  
        var pathParams = {
          'accountId': accountId,
          'envelopeId': envelopeId
        };
        var queryParams = {
        };
        var headerParams = {
        };
        var formParams = {
        };
  
        var authNames = [];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = CommentHistoryResult;
  
        return this.apiClient.callApi(
          '/v2.1/accounts/{accountId}/envelopes/{envelopeId}/comments', 'POST',
          pathParams, queryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      };
  
      /**
       * (Optional)Callback function to receive the result of the getCommentsTranscript operation. If none specified a Promise will be returned.
       * @callback module:api/CommentsApi~getCommentsTranscriptCallback
       * @param {String} error Error message, if any.
       * @param {Object} data The data returned by the service call.
       * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.
       */
  
      /**
       * Gets comment transcript for envelope and user
       * @param {String} accountId The external account number (int) or account ID Guid.
       * @param {String} envelopeId The envelopeId Guid of the envelope being accessed.
       * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.
       * @param {String} optsOrCallback.encoding 
       * @param {module:api/CommentsApi~getCommentsTranscriptCallback} callback The callback function, accepting three arguments: error, data, response
       * data is of type: {@link Object}
       */
      this.getCommentsTranscript = function(accountId, envelopeId, optsOrCallback, callback) {
        optsOrCallback = optsOrCallback || {};
  
        if (typeof optsOrCallback === 'function') {
          callback = optsOrCallback;
          optsOrCallback = {};
        }
  
        var postBody = null;
  
        // verify the required parameter 'accountId' is set
        if (accountId == undefined || accountId == null) {
          throw new Error("Missing the required parameter 'accountId' when calling getCommentsTranscript");
        }
  
        // verify the required parameter 'envelopeId' is set
        if (envelopeId == undefined || envelopeId == null) {
          throw new Error("Missing the required parameter 'envelopeId' when calling getCommentsTranscript");
        }
  
        if (typeof callback !== 'function' &&  arguments.length && typeof arguments[arguments.length-1] === 'function'){
          if (typeof optsOrCallback !== 'undefined') {
            optsOrCallback = callback;
          }
          callback = arguments[arguments.length-1];
        }
  
        var pathParams = {
          'accountId': accountId,
          'envelopeId': envelopeId
        };
        var queryParams = {
          'encoding': optsOrCallback['encoding']
        };
        var headerParams = {
        };
        var formParams = {
        };
  
        var authNames = [];
        var contentTypes = [];
        var accepts = ['application/pdf'];
        var returnType = Object;
  
        return this.apiClient.callApi(
          '/v2.1/accounts/{accountId}/envelopes/{envelopeId}/comments/transcript', 'GET',
          pathParams, queryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, callback
        );
      };
    };
  
    return exports;
  }));
  