Skip to content

Commit 9237c6e

Browse files
committed
arguments explicitly listed
Added comments to explicitly list the arguments for the methods related to using the DocuSign API.
1 parent 1813d06 commit 9237c6e

18 files changed

+255
-88
lines changed

lib/examples/eg001EmbeddedSigning.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ eg001EmbeddedSigning.createController = async (req, res) => {
9595
*/
9696
// ***DS.worker.start ***DS.snippet.1.start
9797
eg001EmbeddedSigning.worker = async (args) => {
98+
// Data for this method
99+
// args.basePath
100+
// args.accessToken
101+
// args.accountId
102+
98103
let dsApiClient = new docusign.ApiClient();
99104
dsApiClient.setBasePath(args.basePath);
100105
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
@@ -132,6 +137,13 @@ eg001EmbeddedSigning.worker = async (args) => {
132137
* @private
133138
*/
134139
function makeEnvelope(args){
140+
// Data for this method
141+
// args.signerEmail
142+
// args.signerName
143+
// args.signerClientId
144+
// demoDocsPath (module constant)
145+
// pdf1File (module constant)
146+
135147
// document 1 (pdf) has tag /sn1/
136148
//
137149
// The envelope has one recipients.
@@ -200,6 +212,13 @@ function makeEnvelope(args){
200212

201213
// ***DS.snippet.3.start
202214
function makeRecipientViewRequest(args) {
215+
// Data for this method
216+
// args.dsReturnUrl
217+
// args.signerEmail
218+
// args.signerName
219+
// args.signerClientId
220+
// args.dsPingUrl
221+
203222
let viewRequest = new docusign.RecipientViewRequest();
204223

205224
// Set the url where you want the recipient to go once they are done signing

lib/examples/eg002SigningViaEmail.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ eg002SigningViaEmail.createController = async (req, res) => {
101101
*/
102102
// ***DS.worker.start ***DS.snippet.1.start
103103
eg002SigningViaEmail.worker = async (args) => {
104+
// Data for this method
105+
// args.basePath
106+
// args.accessToken
107+
// args.accountId
108+
104109
let dsApiClient = new docusign.ApiClient();
105110
dsApiClient.setBasePath(args.basePath);
106111
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
@@ -137,6 +142,17 @@ eg002SigningViaEmail.worker = async (args) => {
137142
* @private
138143
*/
139144
function makeEnvelope(args){
145+
// Data for this method
146+
// args.signerEmail
147+
// args.signerName
148+
// args.ccEmail
149+
// args.ccName
150+
// args.status
151+
// demoDocsPath (module constant)
152+
// doc2File (module constant)
153+
// doc3File (module constant)
154+
155+
140156
// document 1 (html) has tag **signature_1**
141157
// document 2 (docx) has tag /sn1/
142158
// document 3 (pdf) has tag /sn1/
@@ -251,6 +267,12 @@ function makeEnvelope(args){
251267
*/
252268

253269
function document1(args) {
270+
// Data for this method
271+
// args.signerEmail
272+
// args.signerName
273+
// args.ccEmail
274+
// args.ccName
275+
254276
return `
255277
<!DOCTYPE html>
256278
<html>

lib/examples/eg003ListEnvelopes.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ eg003ListEnvelopes.createController = async (req, res) => {
7777
*/
7878
// ***DS.worker.start ***DS.snippet.1.start
7979
eg003ListEnvelopes.worker = async (args) => {
80+
// Data for this method
81+
// args.basePath
82+
// args.accessToken
83+
// args.accountId
84+
85+
8086
let dsApiClient = new docusign.ApiClient();
8187
dsApiClient.setBasePath(args.basePath);
8288
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);

lib/examples/eg004EnvelopeInfo.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ eg004EnvelopeInfo.createController = async (req, res) => {
8787
*/
8888
// ***DS.worker.start ***DS.snippet.1.start
8989
eg004EnvelopeInfo.worker = async (args) => {
90+
// Data for this method
91+
// args.basePath
92+
// args.accessToken
93+
// args.accountId
94+
// args.envelopeId
95+
96+
9097
let dsApiClient = new docusign.ApiClient();
9198
dsApiClient.setBasePath(args.basePath);
9299
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);

lib/examples/eg005EnvelopeRecipients.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,16 @@ eg005EnvelopeRecipients.createController = async (req, res) => {
8383

8484
/**
8585
* This function does the work of listing the envelope's recipients
86-
* @param {object} args An object with the following elements: <br/>
87-
* <tt>dsAPIclient</tt>: The DocuSign API Client object, already set with an access token and base url <br/>
88-
* <tt>accountId</tt>: Current account Id <br/>
89-
* <tt>envelopeId</tt>: envelope Id <br/>
86+
* @param {object} args object
9087
*/
9188
// ***DS.worker.start ***DS.snippet.1.start
9289
eg005EnvelopeRecipients.worker = async (args) => {
90+
// Data for this method
91+
// args.basePath
92+
// args.accessToken
93+
// args.accountId
94+
// args.envelopeId
95+
9396
let dsApiClient = new docusign.ApiClient();
9497
dsApiClient.setBasePath(args.basePath);
9598
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);

lib/examples/eg006EnvelopeDocs.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,17 @@ eg006EnvelopeDocs.createController = async (req, res) => {
100100

101101
/**
102102
* This function does the work of listing the envelope's documents
103-
* @param {object} args An object with the following elements: <br/>
104-
* <tt>dsAPIclient</tt>: The DocuSign API Client object, already set with an access token and base url <br/>
105-
* <tt>accountId</tt>: Current account Id <br/>
106-
* <tt>envelopeId</tt>: envelope Id <br/>
103+
* @param {object} args object
107104
*/
108105
// ***DS.worker.start ***DS.snippet.1.start
109106
eg006EnvelopeDocs.worker = async (args) => {
107+
// Data for this method
108+
// args.basePath
109+
// args.accessToken
110+
// args.accountId
111+
// args.envelopeId
112+
113+
110114
let dsApiClient = new docusign.ApiClient();
111115
dsApiClient.setBasePath(args.basePath);
112116
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);

lib/examples/eg007EnvelopeGetDoc.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,22 @@ eg007EnvelopeGetDoc.createController = async (req, res) => {
9090

9191
/**
9292
* This function does the work of listing the envelope's recipients
93-
* @param {object} args An object with the following elements: <br/>
93+
* @param {object} args object with the following elements: <br/>
9494
* <tt>dsAPIclient</tt>: The DocuSign API Client object, already set with an access token and base url <br/>
9595
* <tt>accountId</tt>: Current account Id <br/>
9696
* <tt>documentId</tt>: the document to be fetched <br/>
9797
* <tt>envelopeDocuments</tt>: object with data about the envelope's documents
9898
*/
9999
// ***DS.worker.start ***DS.snippet.1.start
100100
eg007EnvelopeGetDoc.worker = async (args) => {
101+
// Data for this method
102+
// args.basePath
103+
// args.accessToken
104+
// args.accountId
105+
// args.documentId
106+
// args.envelopeDocuments.envelopeId
107+
// args.envelopeDocuments.documents -- array of {documentId, name, type}
108+
101109
let dsApiClient = new docusign.ApiClient();
102110
dsApiClient.setBasePath(args.basePath);
103111
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);

lib/examples/eg008CreateTemplate.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,20 @@ eg008CreateTemplate.createController = async (req, res) => {
7979

8080
/**
8181
* This function does the work of checking to see if the template exists and creating it if not.
82-
* @param {object} args An object with the following elements: <br/>
83-
* <tt>dsAPIclient</tt>: The DocuSign API Client object, already set with an access token and base url <br/>
84-
* <tt>accountId</tt>: Current account Id <br/>
85-
* <tt>templateName</tt>: The template's name <br/>
82+
* @param {object} args object
8683
*/
8784
// ***DS.worker.start ***DS.snippet.1.start
8885
eg008CreateTemplate.worker = async (args) => {
89-
let dsApiClient = new docusign.ApiClient();
90-
dsApiClient.setBasePath(args.basePath);
91-
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
86+
// Data for this method
87+
// args.basePath
88+
// args.accessToken
89+
// args.accountId
90+
// args.templateName
91+
92+
93+
let dsApiClient = new docusign.ApiClient();
94+
dsApiClient.setBasePath(args.basePath);
95+
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
9296
let templatesApi = new docusign.TemplatesApi(dsApiClient)
9397
, results = null
9498
, templateId = null // the template that exists or will be created.
@@ -131,6 +135,11 @@ eg008CreateTemplate.createController = async (req, res) => {
131135
* @private
132136
*/
133137
function makeTemplate(){
138+
// Data for this method
139+
// demoDocsPath -- module global
140+
// docFile -- module global
141+
// templateName -- module global
142+
134143
// document 1 (pdf) has tag /sn1/
135144
//
136145
// The template has two recipient roles.

lib/examples/eg009UseTemplate.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,16 @@ eg009UseTemplate.createController = async (req, res) => {
9898

9999
/**
100100
* This function does the work of creating the envelope
101-
* @param {object} args An object with the following elements: <br/>
102-
* <tt>dsAPIclient</tt>: The DocuSign API Client object, already set with an access token and base url <br/>
103-
* <tt>accountId</tt>: Current account Id <br/>
104-
* <tt>envelopeArgs</tt>: envelopeArgs, an object with elements
105-
* <tt>templateId</tt>, <tt>signerEmail</tt>, <tt>signerName</tt>,
106-
* <tt>ccEmail</tt>, <tt>ccName</tt>
101+
* @param {object} args object
107102
*/
108103
// ***DS.worker.start ***DS.snippet.1.start
109104
eg009UseTemplate.worker = async (args) => {
105+
// Data for this method
106+
// args.basePath
107+
// args.accessToken
108+
// args.accountId
109+
110+
110111
let dsApiClient = new docusign.ApiClient();
111112
dsApiClient.setBasePath(args.basePath);
112113
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
@@ -128,13 +129,19 @@ eg009UseTemplate.worker = async (args) => {
128129
/**
129130
* Creates envelope from the template
130131
* @function
131-
* @param {Object} args parameters for the envelope:
132-
* <tt>signerEmail</tt>, <tt>signerName</tt>, <tt>ccEmail</tt>, <tt>ccName</tt>,
133-
* <tt>templateId</tt>
132+
* @param {Object} args object
134133
* @returns {Envelope} An envelope definition
135134
* @private
136135
*/
137136
function makeEnvelope(args){
137+
// Data for this method
138+
// args.signerEmail
139+
// args.signerName
140+
// args.ccEmail
141+
// args.ccName
142+
// args.templateId
143+
144+
138145
// The envelope has two recipients.
139146
// recipient 1 - signer
140147
// recipient 2 - cc

lib/examples/eg010SendBinaryDocs.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,18 @@ eg010SendBinaryDocs.createController = async (req, res) => {
9999
/**
100100
* This function does the work of creating the envelope by using
101101
* the API directly with multipart mime
102-
* @param {object} args An object with the following elements: <br/>
103-
* <tt>accountId</tt>: Current account Id <br/>
104-
* <tt> basePath</tt>: base path for making API call <br/>
105-
* <tt> accessToken</tt>: a valid access token <br/>
106-
* <tt>demoDocsPath</tt>: relative path for the demo docs <br/>
107-
* <tt>doc2File: file name for doc 2 <br/>
108-
* <tt>doc3File: file name for doc 3 <br/>
109-
* <tt>envelopeArgs</tt>: envelopeArgs, an object with elements <br/>
110-
* <tt>signerEmail</tt>, <tt>signerName</tt>, <tt>ccEmail</tt>, <tt>ccName</tt>
102+
* @param {object} args object
111103
*/
112104
// ***DS.worker.start ***DS.snippet.1.start
113105
eg010SendBinaryDocs.worker = async (args) => {
106+
// Data for this method
107+
// args.basePath
108+
// args.accessToken
109+
// args.accountId
110+
// demoDocsPath: relative path for the demo docs
111+
// doc2File: file name for doc 2
112+
// doc3File: file name for doc 3
113+
114114

115115
// Step 1. Make the envelope JSON request body
116116
let envelopeJSON = makeEnvelopeJSON( args.envelopeArgs )
@@ -195,12 +195,17 @@ eg010SendBinaryDocs.worker = async (args) => {
195195
* <br>DocuSign will convert all of the documents to the PDF format.
196196
* <br>The recipients' field tags are placed using <b>anchor</b> strings.
197197
* @function
198-
* @param {Object} args parameters for the envelope:
199-
* <tt>signerEmail</tt>, <tt>signerName</tt>, <tt>ccEmail</tt>, <tt>ccName</tt>
198+
* @param {Object} args object
200199
* @returns {Envelope} An envelope definition
201200
* @private
202201
*/
203202
function makeEnvelopeJSON(args){
203+
// Data for this method
204+
// args.signerEmail
205+
// args.signerName
206+
// args.ccEmail
207+
// args.ccName
208+
204209
// document 1 (html) has tag **signature_1**
205210
// document 2 (docx) has tag /sn1/
206211
// document 3 (pdf) has tag /sn1/
@@ -291,12 +296,16 @@ function makeEnvelopeJSON(args){
291296
* Creates document 1
292297
* @function
293298
* @private
294-
* @param {Object} args parameters for the envelope:
295-
* <tt>signerEmail</tt>, <tt>signerName</tt>, <tt>ccEmail</tt>, <tt>ccName</tt>
299+
* @param {Object} args object
296300
* @returns {string} A document in HTML format
297301
*/
298-
299302
function document1(args) {
303+
// Data for this method
304+
// args.signerEmail
305+
// args.signerName
306+
// args.ccEmail
307+
// args.ccName
308+
300309
return `
301310
<!DOCTYPE html>
302311
<html>

lib/examples/eg011EmbeddedSending.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,16 @@ eg011EmbeddedSending.createController = async (req, res) => {
9393
/**
9494
* This function does the work of creating the envelope in
9595
* draft mode and returning a URL for the sender's view
96-
* @param {object} args An object with the following elements: <br/>
97-
* <tt>dsAPIclient</tt>: The DocuSign API Client object, already set with an access token and base url <br/>
98-
* <tt>accountId</tt>: Current account Id <br/>
99-
* <tt>senderView</tt>: tagging or recipient
100-
* <tt>envelopeArgs</tt>: envelopeArgs, an object with elements
101-
* <tt>signerEmail</tt>, <tt>signerName</tt>, <tt>ccEmail</tt>, <tt>ccName</tt>
96+
* @param {object} args object
10297
*/
10398
// ***DS.worker.start ***DS.snippet.1.start
10499
eg011EmbeddedSending.worker = async (args) => {
100+
// Data for this method
101+
// args.basePath
102+
// args.accessToken
103+
// args.accountId
104+
// args.startingView -- 'recipient' or 'tagging'
105+
105106
let dsApiClient = new docusign.ApiClient();
106107
dsApiClient.setBasePath(args.basePath);
107108
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
@@ -134,15 +135,12 @@ eg011EmbeddedSending.worker = async (args) => {
134135
// ***DS.snippet.3.start
135136
function makeSenderViewRequest(args) {
136137
let viewRequest = new docusign.ReturnUrlRequest();
138+
// Data for this method
139+
// args.dsReturnUrl
137140

138141
// Set the url where you want the recipient to go once they are done signing
139142
// should typically be a callback route somewhere in your app.
140-
// The query parameter is included as an example of how
141-
// to save/recover state information during the redirect to
142-
// the DocuSign signing ceremony. It's usually better to use
143-
// the session mechanism of your web framework. Query parameters
144-
// can be changed/spoofed very easily.
145-
viewRequest.returnUrl = args.dsReturnUrl + "?state=123";
143+
viewRequest.returnUrl = args.dsReturnUrl;
146144
return viewRequest
147145
}
148146
// ***DS.snippet.3.end

0 commit comments

Comments
 (0)