UNPKG

docusign-esign

Version:
1,057 lines (892 loc) 172 kB
/** * 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/CustomFields', 'model/DocumentFieldsInformation', 'model/DocumentHtmlDefinition', 'model/DocumentHtmlDefinitionOriginals', 'model/DocumentHtmlDefinitions', 'model/EnvelopeDefinition', 'model/EnvelopeDocument', 'model/EnvelopeTemplate', 'model/EnvelopeTemplateResults', 'model/ErrorDetails', 'model/GroupInformation', 'model/LockInformation', 'model/LockRequest', 'model/Notification', 'model/PageImages', 'model/PageRequest', 'model/RecipientPreviewRequest', 'model/Recipients', 'model/RecipientsUpdateSummary', 'model/Tabs', 'model/TemplateAutoMatchList', 'model/TemplateCustomFields', 'model/TemplateDocumentsResult', 'model/TemplateNotificationRequest', 'model/TemplateRecipients', 'model/TemplateSummary', 'model/TemplateTabs', 'model/TemplateUpdateSummary', 'model/TemplateViewRequest', 'model/ViewUrl'], 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/CustomFields'), require('../model/DocumentFieldsInformation'), require('../model/DocumentHtmlDefinition'), require('../model/DocumentHtmlDefinitionOriginals'), require('../model/DocumentHtmlDefinitions'), require('../model/EnvelopeDefinition'), require('../model/EnvelopeDocument'), require('../model/EnvelopeTemplate'), require('../model/EnvelopeTemplateResults'), require('../model/ErrorDetails'), require('../model/GroupInformation'), require('../model/LockInformation'), require('../model/LockRequest'), require('../model/Notification'), require('../model/PageImages'), require('../model/PageRequest'), require('../model/RecipientPreviewRequest'), require('../model/Recipients'), require('../model/RecipientsUpdateSummary'), require('../model/Tabs'), require('../model/TemplateAutoMatchList'), require('../model/TemplateCustomFields'), require('../model/TemplateDocumentsResult'), require('../model/TemplateNotificationRequest'), require('../model/TemplateRecipients'), require('../model/TemplateSummary'), require('../model/TemplateTabs'), require('../model/TemplateUpdateSummary'), require('../model/TemplateViewRequest'), require('../model/ViewUrl')); } else { // Browser globals (root is window) if (!root.Docusign) { root.Docusign = {}; } root.Docusign.TemplatesApi = factory(root.Docusign.Configuration, root.Docusign.ApiClient, root.Docusign.CustomFields, root.Docusign.DocumentFieldsInformation, root.Docusign.DocumentHtmlDefinition, root.Docusign.DocumentHtmlDefinitionOriginals, root.Docusign.DocumentHtmlDefinitions, root.Docusign.EnvelopeDefinition, root.Docusign.EnvelopeDocument, root.Docusign.EnvelopeTemplate, root.Docusign.EnvelopeTemplateResults, root.Docusign.ErrorDetails, root.Docusign.GroupInformation, root.Docusign.LockInformation, root.Docusign.LockRequest, root.Docusign.Notification, root.Docusign.PageImages, root.Docusign.PageRequest, root.Docusign.RecipientPreviewRequest, root.Docusign.Recipients, root.Docusign.RecipientsUpdateSummary, root.Docusign.Tabs, root.Docusign.TemplateAutoMatchList, root.Docusign.TemplateCustomFields, root.Docusign.TemplateDocumentsResult, root.Docusign.TemplateNotificationRequest, root.Docusign.TemplateRecipients, root.Docusign.TemplateSummary, root.Docusign.TemplateTabs, root.Docusign.TemplateUpdateSummary, root.Docusign.TemplateViewRequest, root.Docusign.ViewUrl); } }(this, function(Configuration, ApiClient, CustomFields, DocumentFieldsInformation, DocumentHtmlDefinition, DocumentHtmlDefinitionOriginals, DocumentHtmlDefinitions, EnvelopeDefinition, EnvelopeDocument, EnvelopeTemplate, EnvelopeTemplateResults, ErrorDetails, GroupInformation, LockInformation, LockRequest, Notification, PageImages, PageRequest, RecipientPreviewRequest, Recipients, RecipientsUpdateSummary, Tabs, TemplateAutoMatchList, TemplateCustomFields, TemplateDocumentsResult, TemplateNotificationRequest, TemplateRecipients, TemplateSummary, TemplateTabs, TemplateUpdateSummary, TemplateViewRequest, ViewUrl) { 'use strict'; /** * Templates service. * @module api/TemplatesApi */ /** * Constructs a new TemplatesApi. * @alias module:api/TemplatesApi * @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 createCustomFields operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~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. */ /** * Creates custom document fields in an existing template document. * Creates custom document fields in an existing template document. * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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/TemplateCustomFields} optsOrCallback.templateCustomFields * @param {module:api/TemplatesApi~createCustomFieldsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/CustomFields} */ this.createCustomFields = function(accountId, templateId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['templateCustomFields']; // 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 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' 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, 'templateId': templateId }; 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}/templates/{templateId}/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/TemplatesApi~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 template document. * Creates custom document fields in an existing template document. * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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/TemplatesApi~createDocumentFieldsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/DocumentFieldsInformation} */ this.createDocumentFields = function(accountId, templateId, 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 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' 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, 'templateId': templateId, '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}/templates/{templateId}/documents/{documentId}/fields', '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/TemplatesApi~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. */ /** * Provides a URL to start an edit view of the Template UI * This method returns a URL for starting an edit view of a template that uses the DocuSign Template UI. * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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/TemplateViewRequest} optsOrCallback.templateViewRequest * @param {module:api/TemplatesApi~createEditViewCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ViewUrl} */ this.createEditView = function(accountId, templateId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['templateViewRequest']; // 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 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' 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, 'templateId': templateId }; 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}/templates/{templateId}/views/edit', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the createLock operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~createLockCallback * @param {String} error Error message, if any. * @param {module:model/LockInformation} 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. */ /** * Lock a template. * Locks the specified template, and sets the time until the lock expires, to prevent other users or recipients from accessing and changing the template. ###### Note: Users must have envelope locking capability enabled to use this function (the userSetting property `canLockEnvelopes` must be set to **true** for the user). * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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/LockRequest} optsOrCallback.lockRequest * @param {module:api/TemplatesApi~createLockCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/LockInformation} */ this.createLock = function(accountId, templateId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['lockRequest']; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling createLock"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling createLock"); } 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, 'templateId': templateId }; var queryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['docusignAccessCode']; var contentTypes = []; var accepts = ['application/json']; var returnType = LockInformation; return this.apiClient.callApi( '/v2.1/accounts/{accountId}/templates/{templateId}/lock', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the createRecipients operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~createRecipientsCallback * @param {String} error Error message, if any. * @param {module:model/Recipients} 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 tabs for a recipient. * Adds one or more recipients to a template. * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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.resendEnvelope * @param {module:model/TemplateRecipients} optsOrCallback.templateRecipients * @param {module:api/TemplatesApi~createRecipientsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Recipients} */ this.createRecipients = function(accountId, templateId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['templateRecipients']; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling createRecipients"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling createRecipients"); } 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, 'templateId': templateId }; var queryParams = { 'resend_envelope': optsOrCallback['resendEnvelope'] }; var headerParams = { }; var formParams = { }; var authNames = ['docusignAccessCode']; var contentTypes = []; var accepts = ['application/json']; var returnType = Recipients; return this.apiClient.callApi( '/v2.1/accounts/{accountId}/templates/{templateId}/recipients', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the createTabs operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~createTabsCallback * @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 tabs for a recipient. * Adds one or more tabs for a recipient. * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template being accessed. * @param {String} recipientId The ID of the recipient 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/TemplateTabs} optsOrCallback.templateTabs * @param {module:api/TemplatesApi~createTabsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Tabs} */ this.createTabs = function(accountId, templateId, recipientId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['templateTabs']; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling createTabs"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling createTabs"); } // verify the required parameter 'recipientId' is set if (recipientId === undefined || recipientId === null) { throw new Error("Missing the required parameter 'recipientId' when calling createTabs"); } 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, 'templateId': templateId, 'recipientId': recipientId }; 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}/templates/{templateId}/recipients/{recipientId}/tabs', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the createTemplate operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~createTemplateCallback * @param {String} error Error message, if any. * @param {module:model/TemplateSummary} 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 from a template. * Creates a template definition using a multipart request. ###Template Email Subject Merge Fields Call this endpoint to insert a recipient name and email address merge fields into the email subject line when creating or sending from a template. The merge fields, based on the recipient's role name, are added to the `emailSubject` property when the template is created or when the template is used to create an envelope. After a template sender adds the name and email information for the recipient and sends the envelope, the recipient information is automatically merged into the appropriate fields in the email subject line. Both the sender and the recipients will see the information in the email subject line for any emails associated with the template. This provides an easy way for senders to organize their envelope emails without having to open an envelope to check the recipient. ###### Note: If merging the recipient information into the subject line causes the subject line to exceed 100 characters, then any characters over the 100 character limit are not included in the subject line. For cases where the recipient name or email is expected to be long, you should consider placing the merge field at the start of the email subject. To add a recipient's name in the subject line add the following text in the `emailSubject` property when creating the template or when sending an envelope from a template: [[<roleName>_UserName]] Example: `"emailSubject":"[[Signer 1_UserName]], Please sign this NDA",` To add a recipient's email address in the subject line add the following text in the `emailSubject` property when creating the template or when sending an envelope from a template: [[<roleName>_Email]] Example: `"emailSubject":"[[Signer 1_Email]], Please sign this NDA",` In both cases the <roleName> is the recipient's contents of the `roleName` property in the template. For cases where another recipient (such as an Agent, Editor, or Intermediary recipient) is entering the name and email information for the recipient included in the email subject, then [[<roleName>_UserName]] or [[<roleName>_Email]] is shown in the email subject. * @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/EnvelopeTemplate} optsOrCallback.envelopeTemplate * @param {module:api/TemplatesApi~createTemplateCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/TemplateSummary} */ this.createTemplate = function(accountId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['envelopeTemplate']; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling createTemplate"); } 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 = TemplateSummary; return this.apiClient.callApi( '/v2.1/accounts/{accountId}/templates', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the createTemplateDocumentResponsiveHtmlPreview operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~createTemplateDocumentResponsiveHtmlPreviewCallback * @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. */ /** * Post Responsive HTML Preview for a document in a template. * Creates a preview of the [responsive](/docs/esign-rest-api/esign101/concepts/responsive/), HTML version of a specific template 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} templateId The ID of the template 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/TemplatesApi~createTemplateDocumentResponsiveHtmlPreviewCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/DocumentHtmlDefinitions} */ this.createTemplateDocumentResponsiveHtmlPreview = function(accountId, templateId, 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 createTemplateDocumentResponsiveHtmlPreview"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling createTemplateDocumentResponsiveHtmlPreview"); } // verify the required parameter 'documentId' is set if (documentId === undefined || documentId === null) { throw new Error("Missing the required parameter 'documentId' when calling createTemplateDocumentResponsiveHtmlPreview"); } 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, 'templateId': templateId, '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}/templates/{templateId}/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 createTemplateDocumentTabs operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~createTemplateDocumentTabsCallback * @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 a tempate * Adds tabs to the document specified by `documentId` in the template specified by `templateId`. 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/templates/templatedocumenttabs/create/#definition__templatetabs_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} templateId The ID of the template 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/TemplateTabs} optsOrCallback.templateTabs * @param {module:api/TemplatesApi~createTemplateDocumentTabsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Tabs} */ this.createTemplateDocumentTabs = function(accountId, templateId, documentId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['templateTabs']; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling createTemplateDocumentTabs"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling createTemplateDocumentTabs"); } // verify the required parameter 'documentId' is set if (documentId === undefined || documentId === null) { throw new Error("Missing the required parameter 'documentId' when calling createTemplateDocumentTabs"); } 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, 'templateId': templateId, '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}/templates/{templateId}/documents/{documentId}/tabs', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the createTemplateRecipientPreview operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~createTemplateRecipientPreviewCallback * @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. */ /** * Provides a URL to start a recipient view of the Envelope UI * This method returns a URL for a template recipient preview in the DocuSign UI that you can embed in your application. You use this method to enable the sender to preview the recipients' experience. For more information, see [Preview and Send](https://support.docusign.com/en/guides/ndse-user-guide-send-your-documents). * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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/RecipientPreviewRequest} optsOrCallback.recipientPreviewRequest * @param {module:api/TemplatesApi~createTemplateRecipientPreviewCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ViewUrl} */ this.createTemplateRecipientPreview = function(accountId, templateId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['recipientPreviewRequest']; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling createTemplateRecipientPreview"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling createTemplateRecipientPreview"); } 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, 'templateId': templateId }; 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}/templates/{templateId}/views/recipient_preview', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the createTemplateResponsiveHtmlPreview operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~createTemplateResponsiveHtmlPreviewCallback * @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 all documents in a template. * Creates a preview of the [responsive](/docs/esign-rest-api/esign101/concepts/responsive/), HTML versions of all of the documents associated with a template. This method enables you to preview the PDF document conversions 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 documents. * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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/TemplatesApi~createTemplateResponsiveHtmlPreviewCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/DocumentHtmlDefinitions} */ this.createTemplateResponsiveHtmlPreview = function(accountId, templateId, 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 createTemplateResponsiveHtmlPreview"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling createTemplateResponsiveHtmlPreview"); } 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, 'templateId': templateId }; 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}/templates/{templateId}/responsive_html_preview', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the deleteCustomFields operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~deleteCustomFieldsCallback * @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. */ /** * Deletes envelope custom fields in a template. * Deletes envelope custom fields in a template. * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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/TemplateCustomFields} optsOrCallback.templateCustomFields * @param {module:api/TemplatesApi~deleteCustomFieldsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/CustomFields} */ this.deleteCustomFields = function(accountId, templateId, optsOrCallback, callback) { optsOrCallback = optsOrCallback || {}; if (typeof optsOrCallback === 'function') { callback = optsOrCallback; optsOrCallback = {}; } var postBody = optsOrCallback['templateCustomFields']; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling deleteCustomFields"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling deleteCustomFields"); } 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, 'templateId': templateId }; 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}/templates/{templateId}/custom_fields', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the deleteDocumentFields operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~deleteDocumentFieldsCallback * @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. */ /** * Deletes custom document fields from an existing template document. * Deletes custom document fields from an existing template document. * @param {String} accountId The external account number (int) or account ID Guid. * @param {String} templateId The ID of the template 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/TemplatesApi~deleteDocumentFieldsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/DocumentFieldsInformation} */ this.deleteDocumentFields = function(accountId, templateId, 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 deleteDocumentFields"); } // verify the required parameter 'templateId' is set if (templateId === undefined || templateId === null) { throw new Error("Missing the required parameter 'templateId' when calling deleteDocumentFields"); } // verify the required parameter 'documentId' is set if (documentId === undefined || documentId === null) { throw new Error("Missing the required parameter 'documentId' when calling deleteDocumentFields"); } 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, 'templateId': templateId, '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}/templates/{templateId}/documents/{documentId}/fields', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }; /** * (Optional) Callback function to receive the result of the deleteDocumentPage operation. If none specified a Promise will be returned. * @callback module:api/TemplatesApi~deleteDocumentPageCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data. */ /** * Deletes a page from a document in an template. * Deletes a page from a document in a template based on the page number. * @param {String} accountId The external account number (int) or account ID Guid. * @param