docusign-esign
Version:
Docusign Node.js API client.
919 lines (772 loc) • 448 kB
JavaScript
/**
* Docusign eSignature REST API
* The Docusign eSignature 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/Attachment', 'model/ChunkedUploadRequest', 'model/ChunkedUploadResponse', 'model/CommentHistoryResult', 'model/CommentsPublish', 'model/ConnectHistoricalEnvelopeRepublish', 'model/ConsoleViewRequest', 'model/ConsumerDisclosure', 'model/CorrectViewRequest', 'model/CustomFields', 'model/CustomFieldsEnvelope', 'model/DelayedRouting', 'model/DocGenFormFieldRequest', 'model/DocGenFormFieldResponse', 'model/DocumentFieldsInformation', 'model/DocumentHtmlDefinition', 'model/DocumentHtmlDefinitionOriginals', 'model/DocumentHtmlDefinitions', 'model/DocumentTemplateList', 'model/DocumentVisibilityList', 'model/EmailSettings', 'model/Envelope', 'model/EnvelopeAttachmentsRequest', 'model/EnvelopeAttachmentsResult', 'model/EnvelopeAuditEventResponse', 'model/EnvelopeDefinition', 'model/EnvelopeDocument', 'model/EnvelopeDocumentsResult', 'model/EnvelopeFormData', 'model/EnvelopeIdsRequest', 'model/EnvelopeNotificationRequest', 'model/EnvelopePublishTransaction', 'model/EnvelopeSummary', 'model/EnvelopeTransferRule', 'model/EnvelopeTransferRuleInformation', 'model/EnvelopeTransferRuleRequest', 'model/EnvelopeUpdateSummary', 'model/EnvelopeViewRequest', 'model/EnvelopesInformation', 'model/ErrorDetails', 'model/IdEvidenceResourceToken', 'model/IdEvidenceViewLink', 'model/LockInformation', 'model/LockRequest', 'model/Notification', 'model/PageImages', 'model/PageRequest', 'model/RecipientPreviewRequest', 'model/RecipientViewRequest', 'model/Recipients', 'model/RecipientsUpdateSummary', 'model/ScheduledSending', 'model/Tabs', 'model/TemplateDocumentVisibilityList', 'model/TemplateInformation', 'model/UserSignature', 'model/ViewUrl', 'model/Workflow', 'model/WorkflowStep'], 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/Attachment'), require('../model/ChunkedUploadRequest'), require('../model/ChunkedUploadResponse'), require('../model/CommentHistoryResult'), require('../model/CommentsPublish'), require('../model/ConnectHistoricalEnvelopeRepublish'), require('../model/ConsoleViewRequest'), require('../model/ConsumerDisclosure'), require('../model/CorrectViewRequest'), require('../model/CustomFields'), require('../model/CustomFieldsEnvelope'), require('../model/DelayedRouting'), require('../model/DocGenFormFieldRequest'), require('../model/DocGenFormFieldResponse'), require('../model/DocumentFieldsInformation'), require('../model/DocumentHtmlDefinition'), require('../model/DocumentHtmlDefinitionOriginals'), require('../model/DocumentHtmlDefinitions'), require('../model/DocumentTemplateList'), require('../model/DocumentVisibilityList'), require('../model/EmailSettings'), require('../model/Envelope'), require('../model/EnvelopeAttachmentsRequest'), require('../model/EnvelopeAttachmentsResult'), require('../model/EnvelopeAuditEventResponse'), require('../model/EnvelopeDefinition'), require('../model/EnvelopeDocument'), require('../model/EnvelopeDocumentsResult'), require('../model/EnvelopeFormData'), require('../model/EnvelopeIdsRequest'), require('../model/EnvelopeNotificationRequest'), require('../model/EnvelopePublishTransaction'), require('../model/EnvelopeSummary'), require('../model/EnvelopeTransferRule'), require('../model/EnvelopeTransferRuleInformation'), require('../model/EnvelopeTransferRuleRequest'), require('../model/EnvelopeUpdateSummary'), require('../model/EnvelopeViewRequest'), require('../model/EnvelopesInformation'), require('../model/ErrorDetails'), require('../model/IdEvidenceResourceToken'), require('../model/IdEvidenceViewLink'), require('../model/LockInformation'), require('../model/LockRequest'), require('../model/Notification'), require('../model/PageImages'), require('../model/PageRequest'), require('../model/RecipientPreviewRequest'), require('../model/RecipientViewRequest'), require('../model/Recipients'), require('../model/RecipientsUpdateSummary'), require('../model/ScheduledSending'), require('../model/Tabs'), require('../model/TemplateDocumentVisibilityList'), require('../model/TemplateInformation'), require('../model/UserSignature'), require('../model/ViewUrl'), require('../model/Workflow'), require('../model/WorkflowStep'));
} else {
// Browser globals (root is window)
if (!root.Docusign) {
root.Docusign = {};
}
root.Docusign.EnvelopesApi = factory(root.Docusign.Configuration, root.Docusign.ApiClient, root.Docusign.Attachment, root.Docusign.ChunkedUploadRequest, root.Docusign.ChunkedUploadResponse, root.Docusign.CommentHistoryResult, root.Docusign.CommentsPublish, root.Docusign.ConnectHistoricalEnvelopeRepublish, root.Docusign.ConsoleViewRequest, root.Docusign.ConsumerDisclosure, root.Docusign.CorrectViewRequest, root.Docusign.CustomFields, root.Docusign.CustomFieldsEnvelope, root.Docusign.DelayedRouting, root.Docusign.DocGenFormFieldRequest, root.Docusign.DocGenFormFieldResponse, root.Docusign.DocumentFieldsInformation, root.Docusign.DocumentHtmlDefinition, root.Docusign.DocumentHtmlDefinitionOriginals, root.Docusign.DocumentHtmlDefinitions, root.Docusign.DocumentTemplateList, root.Docusign.DocumentVisibilityList, root.Docusign.EmailSettings, root.Docusign.Envelope, root.Docusign.EnvelopeAttachmentsRequest, root.Docusign.EnvelopeAttachmentsResult, root.Docusign.EnvelopeAuditEventResponse, root.Docusign.EnvelopeDefinition, root.Docusign.EnvelopeDocument, root.Docusign.EnvelopeDocumentsResult, root.Docusign.EnvelopeFormData, root.Docusign.EnvelopeIdsRequest, root.Docusign.EnvelopeNotificationRequest, root.Docusign.EnvelopePublishTransaction, root.Docusign.EnvelopeSummary, root.Docusign.EnvelopeTransferRule, root.Docusign.EnvelopeTransferRuleInformation, root.Docusign.EnvelopeTransferRuleRequest, root.Docusign.EnvelopeUpdateSummary, root.Docusign.EnvelopeViewRequest, root.Docusign.EnvelopesInformation, root.Docusign.ErrorDetails, root.Docusign.IdEvidenceResourceToken, root.Docusign.IdEvidenceViewLink, root.Docusign.LockInformation, root.Docusign.LockRequest, root.Docusign.Notification, root.Docusign.PageImages, root.Docusign.PageRequest, root.Docusign.RecipientPreviewRequest, root.Docusign.RecipientViewRequest, root.Docusign.Recipients, root.Docusign.RecipientsUpdateSummary, root.Docusign.ScheduledSending, root.Docusign.Tabs, root.Docusign.TemplateDocumentVisibilityList, root.Docusign.TemplateInformation, root.Docusign.UserSignature, root.Docusign.ViewUrl, root.Docusign.Workflow, root.Docusign.WorkflowStep);
}
}(this, function(Configuration, ApiClient, Attachment, ChunkedUploadRequest, ChunkedUploadResponse, CommentHistoryResult, CommentsPublish, ConnectHistoricalEnvelopeRepublish, ConsoleViewRequest, ConsumerDisclosure, CorrectViewRequest, CustomFields, CustomFieldsEnvelope, DelayedRouting, DocGenFormFieldRequest, DocGenFormFieldResponse, DocumentFieldsInformation, DocumentHtmlDefinition, DocumentHtmlDefinitionOriginals, DocumentHtmlDefinitions, DocumentTemplateList, DocumentVisibilityList, EmailSettings, Envelope, EnvelopeAttachmentsRequest, EnvelopeAttachmentsResult, EnvelopeAuditEventResponse, EnvelopeDefinition, EnvelopeDocument, EnvelopeDocumentsResult, EnvelopeFormData, EnvelopeIdsRequest, EnvelopeNotificationRequest, EnvelopePublishTransaction, EnvelopeSummary, EnvelopeTransferRule, EnvelopeTransferRuleInformation, EnvelopeTransferRuleRequest, EnvelopeUpdateSummary, EnvelopeViewRequest, EnvelopesInformation, ErrorDetails, IdEvidenceResourceToken, IdEvidenceViewLink, LockInformation, LockRequest, Notification, PageImages, PageRequest, RecipientPreviewRequest, RecipientViewRequest, Recipients, RecipientsUpdateSummary, ScheduledSending, Tabs, TemplateDocumentVisibilityList, TemplateInformation, UserSignature, ViewUrl, Workflow, WorkflowStep) {
'use strict';
/**
* Envelopes service.
* @module api/EnvelopesApi
*/
/**
* Constructs a new EnvelopesApi.
* @alias module:api/EnvelopesApi
* @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 applyTemplate operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~applyTemplateCallback
* @param {String} error Error message, if any.
* @param {module:model/DocumentTemplateList} 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.
*/
/**
* Adds templates to an envelope.
* Adds templates to the specified envelope.
* @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.preserveTemplateRecipient
* @param {module:model/DocumentTemplateList} optsOrCallback.documentTemplateList
* @param {module:api/EnvelopesApi~applyTemplateCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DocumentTemplateList}
*/
this.applyTemplate = function(accountId, envelopeId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['documentTemplateList'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling applyTemplate");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling applyTemplate");
}
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 = {
'preserve_template_recipient': optsOrCallback['preserveTemplateRecipient']
};
var headerParams = {
};
var formParams = {
};
var authNames = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = DocumentTemplateList;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/templates', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the applyTemplateToDocument operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~applyTemplateToDocumentCallback
* @param {String} error Error message, if any.
* @param {module:model/DocumentTemplateList} 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.
*/
/**
* Adds templates to a document in an envelope.
* Adds templates to a document in the specified envelope.
* @param {String} accountId The external account number (int) or account ID Guid.
* @param {String} envelopeId The envelopeId Guid of the envelope being accessed.
* @param {String} documentId The ID of the document 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.preserveTemplateRecipient
* @param {module:model/DocumentTemplateList} optsOrCallback.documentTemplateList
* @param {module:api/EnvelopesApi~applyTemplateToDocumentCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DocumentTemplateList}
*/
this.applyTemplateToDocument = function(accountId, envelopeId, documentId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['documentTemplateList'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling applyTemplateToDocument");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling applyTemplateToDocument");
}
// verify the required parameter 'documentId' is set
if (documentId === undefined || documentId === null) {
throw new Error("Missing the required parameter 'documentId' when calling applyTemplateToDocument");
}
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,
'documentId': documentId
};
var queryParams = {
'preserve_template_recipient': optsOrCallback['preserveTemplateRecipient']
};
var headerParams = {
};
var formParams = {
};
var authNames = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = DocumentTemplateList;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/templates', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createChunkedUpload operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createChunkedUploadCallback
* @param {String} error Error message, if any.
* @param {module:model/ChunkedUploadResponse} 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.
*/
/**
* Initiate a new ChunkedUpload.
* This method initiates a new chunked upload with the first part of the content.
* @param {String} accountId The external account number (int) or account ID Guid.
* @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/ChunkedUploadRequest} optsOrCallback.chunkedUploadRequest
* @param {module:api/EnvelopesApi~createChunkedUploadCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ChunkedUploadResponse}
*/
this.createChunkedUpload = function(accountId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['chunkedUploadRequest'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createChunkedUpload");
}
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
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = ChunkedUploadResponse;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/chunked_uploads', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createConsoleView operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createConsoleViewCallback
* @param {String} error Error message, if any.
* @param {module:model/ViewUrl} 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.
*/
/**
* Returns a URL to the authentication view UI.
* Returns a URL that allows you to embed the authentication view of the DocuSign UI in your applications.
* @param {String} accountId The external account number (int) or account ID Guid.
* @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/ConsoleViewRequest} optsOrCallback.consoleViewRequest
* @param {module:api/EnvelopesApi~createConsoleViewCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ViewUrl}
*/
this.createConsoleView = function(accountId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['consoleViewRequest'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createConsoleView");
}
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
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = ViewUrl;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/views/console', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createCorrectView operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createCorrectViewCallback
* @param {String} error Error message, if any.
* @param {module:model/ViewUrl} 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.
*/
/**
* Returns a URL to the envelope correction UI.
* Returns a URL that allows you to embed the envelope correction view of the DocuSign UI in your applications.
Important: iFrames should not be used for embedded operations on mobile devices due to screen space issues. For iOS devices DocuSign recommends using a WebView.
* @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/EnvelopeViewRequest} optsOrCallback.envelopeViewRequest
* @param {module:api/EnvelopesApi~createCorrectViewCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ViewUrl}
*/
this.createCorrectView = function(accountId, envelopeId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['envelopeViewRequest'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createCorrectView");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling createCorrectView");
}
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 = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = ViewUrl;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/views/correct', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createCustomFields operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createCustomFieldsCallback
* @param {String} error Error message, if any.
* @param {module:model/CustomFields} 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.
*/
/**
* Updates envelope custom fields for an envelope.
* Updates the envelope custom fields for draft and in-process envelopes.
Each custom field used in an envelope must have a unique name.
* @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/CustomFields} optsOrCallback.customFields
* @param {module:api/EnvelopesApi~createCustomFieldsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/CustomFields}
*/
this.createCustomFields = function(accountId, envelopeId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['customFields'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createCustomFields");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling createCustomFields");
}
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 = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = CustomFields;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/custom_fields', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createDocumentFields operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createDocumentFieldsCallback
* @param {String} error Error message, if any.
* @param {module:model/DocumentFieldsInformation} 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.
*/
/**
* Creates custom document fields in an existing envelope document.
* Creates custom document fields in an existing envelope document.
* @param {String} accountId The external account number (int) or account ID Guid.
* @param {String} envelopeId The envelopeId Guid of the envelope being accessed.
* @param {String} documentId The ID of the document 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/DocumentFieldsInformation} optsOrCallback.documentFieldsInformation
* @param {module:api/EnvelopesApi~createDocumentFieldsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DocumentFieldsInformation}
*/
this.createDocumentFields = function(accountId, envelopeId, documentId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['documentFieldsInformation'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createDocumentFields");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling createDocumentFields");
}
// verify the required parameter 'documentId' is set
if (documentId === undefined || documentId === null) {
throw new Error("Missing the required parameter 'documentId' when calling createDocumentFields");
}
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,
'documentId': documentId
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = DocumentFieldsInformation;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createDocumentResponsiveHtmlPreview operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createDocumentResponsiveHtmlPreviewCallback
* @param {String} error Error message, if any.
* @param {module:model/DocumentHtmlDefinitions} 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.
*/
/**
* Get Responsive HTML Preview for a document in an envelope.
* Creates a preview of the
[responsive](/docs/esign-rest-api/esign101/concepts/responsive/)
HTML version of a specific document.
This method enables you to preview a PDF document
conversion to responsive HTML across device types prior to sending.
The request body is a `documentHtmlDefinition` object, which holds the responsive signing parameters that define how to generate the HTML version of the signing document.
* @param {String} accountId The external account number (int) or account ID Guid.
* @param {String} envelopeId The envelopeId Guid of the envelope being accessed.
* @param {String} documentId The ID of the document 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/DocumentHtmlDefinition} optsOrCallback.documentHtmlDefinition
* @param {module:api/EnvelopesApi~createDocumentResponsiveHtmlPreviewCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/DocumentHtmlDefinitions}
*/
this.createDocumentResponsiveHtmlPreview = function(accountId, envelopeId, documentId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['documentHtmlDefinition'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createDocumentResponsiveHtmlPreview");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling createDocumentResponsiveHtmlPreview");
}
// verify the required parameter 'documentId' is set
if (documentId === undefined || documentId === null) {
throw new Error("Missing the required parameter 'documentId' when calling createDocumentResponsiveHtmlPreview");
}
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,
'documentId': documentId
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = DocumentHtmlDefinitions;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/responsive_html_preview', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createDocumentTabs operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createDocumentTabsCallback
* @param {String} error Error message, if any.
* @param {module:model/Tabs} 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.
*/
/**
* Adds the tabs to an envelope document
* Adds tabs to the document specified by `documentId` in the
envelope specified by `envelopeId`.
In the request body, you only need to specify the tabs that your
are adding. For example, to add a text
[prefill tab](/docs/esign-rest-api/reference/envelopes/envelopedocumenttabs/create/#definition__tabs_prefilltabs),
your request body might look like this:
```
{
"prefillTabs": {
"textTabs": [
{
"value": "a prefill text tab",
"pageNumber": "1",
"documentId": "1",
"xPosition": 316,
"yPosition": 97
}
]
}
}
```
* @param {String} accountId The external account number (int) or account ID Guid.
* @param {String} envelopeId The envelopeId Guid of the envelope being accessed.
* @param {String} documentId The ID of the document 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/Tabs} optsOrCallback.tabs
* @param {module:api/EnvelopesApi~createDocumentTabsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/Tabs}
*/
this.createDocumentTabs = function(accountId, envelopeId, documentId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['tabs'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createDocumentTabs");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling createDocumentTabs");
}
// verify the required parameter 'documentId' is set
if (documentId === undefined || documentId === null) {
throw new Error("Missing the required parameter 'documentId' when calling createDocumentTabs");
}
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,
'documentId': documentId
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = Tabs;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/tabs', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createEditView operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createEditViewCallback
* @param {String} error Error message, if any.
* @param {module:model/ViewUrl} 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.
*/
/**
* Returns a URL to the edit view UI.
* Returns a URL that allows you to embed the edit view of the DocuSign UI in your applications. This is a one-time use login token that allows the user to be placed into the DocuSign editing view.
Upon sending completion, the user is returned to the return URL provided by the API application.
Important: iFrames should not be used for embedded operations on mobile devices due to screen space issues. For iOS devices DocuSign recommends using a WebView.
* @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/EnvelopeViewRequest} optsOrCallback.envelopeViewRequest
* @param {module:api/EnvelopesApi~createEditViewCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ViewUrl}
*/
this.createEditView = function(accountId, envelopeId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['envelopeViewRequest'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createEditView");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling createEditView");
}
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 = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = ViewUrl;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/views/edit', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createEmailSettings operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createEmailSettingsCallback
* @param {String} error Error message, if any.
* @param {module:model/EmailSettings} 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.
*/
/**
* Adds email setting overrides to an envelope.
* Adds email override settings, changing the email address to reply to an email address, name, or the BCC for email archive information, for the envelope. Note that adding email settings will only affect email communications that occur after the addition was made.
### Important: The BCC Email address feature is designed to provide a copy of all email communications for external archiving purposes. DocuSign recommends that envelopes sent using the BCC for Email Archive feature, including the BCC Email Override option, include additional signer authentication options. To send a copy of the envelope to a recipient who does not need to sign, use a Carbon Copies or Certified Deliveries Recipient Type.
* @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/EmailSettings} optsOrCallback.emailSettings
* @param {module:api/EnvelopesApi~createEmailSettingsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/EmailSettings}
*/
this.createEmailSettings = function(accountId, envelopeId, optsOrCallback, callback) {
optsOrCallback = optsOrCallback || {};
if (typeof optsOrCallback === 'function') {
callback = optsOrCallback;
optsOrCallback = {};
}
var postBody = optsOrCallback['emailSettings'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling createEmailSettings");
}
// verify the required parameter 'envelopeId' is set
if (envelopeId === undefined || envelopeId === null) {
throw new Error("Missing the required parameter 'envelopeId' when calling createEmailSettings");
}
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 = ['docusignAccessCode'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = EmailSettings;
return this.apiClient.callApi(
'/v2.1/accounts/{accountId}/envelopes/{envelopeId}/email_settings', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* (Optional) Callback function to receive the result of the createEnvelope operation. If none specified a Promise will be returned.
* @callback module:api/EnvelopesApi~createEnvelopeCallback
* @param {String} error Error message, if any.
* @param {module:model/EnvelopeSummary} 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.
*/
/**
* Creates an envelope.
* Creates an envelope.
Using this function you can:
* Create an envelope and send it.
* Create an envelope from an existing template and send it.
In either case, you can choose to save the envelope as a draft envelope instead of sending it by setting the request's `status` property to `created` instead of `sent`.
## Sending Envelopes
Documents can be included with the Envelopes::create call itself or a template can include documents. Documents can be added by using a multi-part/form request or by using the `documentBase64` field of the [`document` object](#/definitions/document)
### Recipient Types
An [`envelopeDefinition` object](#/definitions/envelopeDefinition) is used as the method's body. Envelope recipients can be defined in the envelope or in templates. The `envelopeDefinition` object's `recipients` field is an [`EnvelopeRecipients` resource object](#/definitions/EnvelopeRecipients). It includes arrays of the seven types of recipients defined by DocuSign:
Recipient type | Object definition
-------------- | -----------------
agent (can add name and email information for later recipients/signers) | [`agent`](#/definitions/agent)
carbon copy (receives a copy of the documents) | [`carbonCopy`](#/definitions/carbonCopy)
certified delivery (receives a copy of the documents and must acknowledge receipt) | [`certifiedDelivery`](#/definitions/certifiedDelivery)
editor (can change recipients and document fields for later recipients/signers) | [`editor`](#/definitions/editor)
in-person signer ("hosts" someone who signs in-person) | [`inPersonSigner`](#/definitions/inPersonSigner)
intermediary (can add name and email information for some later recipients/signers.) | [`intermediary`](#/definitions/intermediary)
signer (signs and/or updates document fields) | [`signer`](#/definitions/signer)
Additional information about the different types of recipients is available from the [`EnvelopeRecipients` resource page](../../EnvelopeRecipients) and from the [Developer Center](https://www.docusign.com/developer-center/explore/features/recipients)
### Tabs
Tabs (also referred to as `tags` and as `fields` in the web sending user interface), can be defined in the `envelopeDefinition`, in templates, by transforming PDF Form Fields, or by using Composite Templates (see below).
Defining tabs: the `inPersonSigner`, and `signer` recipient objects include a `tabs` field. It is an [`EnvelopeTabs` resource object](#/definitions/EnvelopeTabs). It includes arrays of the 24 different tab types available. See the [`EnvelopeTabs` resource](../../EnvelopeTabs) for more information.
## Using Templates
Envelopes use specific people or groups as recipients. Templates can specify a role, eg `account_manager.` When a template is used in an envelope, the roles must be replaced with specific people or groups.
When you create an envelope using a `templateId`, the different recipient type objects within the [`EnvelopeRecipients` object](#/definitions/EnvelopeRecipients) are used to assign recipients to the template's roles via the `roleName` property. The recipient objects can also override settings that were specified in the template, and set values for tab fields that were defined in the template.
### Message Lock
When a template is added or applied to an envelope and the template has a locked email subject and message, that subject and message are used for the envelope and cannot be changed even if another locked template is subsequently added or applied to the envelope. The field `messageLock` is used to lock the email subject and message.
If an email subject or message is entered before adding or applying a template with `messageLock` **true**, the email subject and message is overwritten with the locked email subject and message from the template.
## Envelope Status
The status of sent envelopes can be determined through the DocuSign webhook system or by polling. Webhooks are highly recommended: they provide your application with the quickest updates when an envelope's status changes. DocuSign limits polling to once every 15 minutes or less frequently.
When a webhook is used, DocuSign calls your application, via the URL you provide, with a notification XML message.
See the [Webhook recipe](https://www.docusign.com/developer-center/recipes/webhook-status) for examples and live demos of using webhooks.
## Webhook Options
The two webhook options, *eventNotification* and *Connect* use the same notification mechanism and message formats. eventNotification is used to create a webhook for a specific envelope sent via the API. Connect webhooks can be used for any en