/// <summary>
        /// Posts a list of comments for authorized user
        /// </summary>
        /// <exception cref="DocuSign.eSign.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId">The external account number (int) or account ID Guid.</param>/// <param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param>
        /// <param name="commentsPublish"> (optional)</param>

        /// <returns>Task of CommentHistoryResult</returns>
        public async System.Threading.Tasks.Task <CommentHistoryResult> CreateEnvelopeCommentsAsync(string accountId, string envelopeId, CommentsPublish commentsPublish = null)
        {
            ApiResponse <CommentHistoryResult> localVarResponse = await CreateEnvelopeCommentsAsyncWithHttpInfo(accountId, envelopeId, commentsPublish);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Posts a list of comments for authorized user
        /// </summary>
        /// <exception cref="DocuSign.eSign.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId">The external account number (int) or account ID Guid.</param>/// <param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param>
        /// <param name="commentsPublish"> (optional)</param>

        /// <returns>Task of ApiResponse (CommentHistoryResult)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <CommentHistoryResult> > CreateEnvelopeCommentsAsyncWithHttpInfo(string accountId, string envelopeId, CommentsPublish commentsPublish = null)
        {
            // verify the required parameter 'accountId' is set
            if (accountId == null)
            {
                throw new ApiException(400, "Missing required parameter 'accountId' when calling CommentsApi->CreateEnvelopeComments");
            }
            // verify the required parameter 'envelopeId' is set
            if (envelopeId == null)
            {
                throw new ApiException(400, "Missing required parameter 'envelopeId' when calling CommentsApi->CreateEnvelopeComments");
            }

            var    localVarPath         = "/v2.1/accounts/{accountId}/envelopes/{envelopeId}/comments";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType    = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (accountId != null)
            {
                localVarPathParams.Add("accountId", Configuration.ApiClient.ParameterToString(accountId));                    // path parameter
            }
            if (envelopeId != null)
            {
                localVarPathParams.Add("envelopeId", Configuration.ApiClient.ParameterToString(envelopeId));                     // path parameter
            }
            if (commentsPublish != null && commentsPublish.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(commentsPublish); // http body (model) parameter
            }
            else
            {
                localVarPostBody = commentsPublish; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("CreateEnvelopeComments", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <CommentHistoryResult>(localVarStatusCode,
                                                          localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                          (CommentHistoryResult)Configuration.ApiClient.Deserialize(localVarResponse, typeof(CommentHistoryResult))));
        }
        /// <summary>
        /// Posts a list of comments for authorized user
        /// </summary>
        /// <exception cref="DocuSign.eSign.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId">The external account number (int) or account ID Guid.</param>/// <param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param>
        /// <param name="commentsPublish"> (optional)</param>

        /// <returns>CommentHistoryResult</returns>
        public CommentHistoryResult CreateEnvelopeComments(string accountId, string envelopeId, CommentsPublish commentsPublish = null)
        {
            ApiResponse <CommentHistoryResult> localVarResponse = CreateEnvelopeCommentsWithHttpInfo(accountId, envelopeId, commentsPublish);

            return(localVarResponse.Data);
        }