@@ -48,7 +48,6 @@ public static String sendBinaryDocs(
4848 String accountId ,
4949 String accessToken
5050 ) throws IOException {
51- // Step 1. Gather documents and their headers
5251 List <DocumentInfo > documents = List .of (
5352 new DocumentInfo (HTML_DOCUMENT_NAME , "1" , DocumentType .HTML ,
5453 EnvelopeHelpers .createHtmlFromTemplateFile (HTML_DOCUMENT_FILE_NAME , "args" , args )
@@ -59,15 +58,15 @@ public static String sendBinaryDocs(
5958 EnvelopeHelpers .readFile (PDF_DOCUMENT_FILE_NAME ))
6059 );
6160
62- // Step 2. Make the envelope JSON request body
61+ // Make the envelope JSON request body
6362 JSONObject envelopeJSON = SendBinaryDocsService .makeEnvelopeJSON (
6463 signerName ,
6564 signerEmail ,
6665 ccName ,
6766 ccEmail ,
6867 documents );
6968
70- // Step 3. Create the multipart body
69+ // Create the multipart body
7170 URL uri = new URL (String .format ("%s/v2.1/accounts/%s/envelopes" , basePath , accountId ));
7271 String contentType = String .join (
7372 "" ,
@@ -81,6 +80,7 @@ public static String sendBinaryDocs(
8180 connection .setDoOutput (true );
8281
8382 // See https://developers.docusign.com/esign-rest-api/guides/requests-and-responses
83+ //ds-snippet-start:eSign10Step4
8484 DataOutputStream buffer = new DataOutputStream (connection .getOutputStream ());
8585 SendBinaryDocsService .writeBoundaryHeader (buffer , MediaType .APPLICATION_JSON , "form-data" );
8686 buffer .writeBytes (envelopeJSON .toString (DoneExample .JSON_INDENT_FACTOR ));
@@ -102,6 +102,7 @@ public static String sendBinaryDocs(
102102
103103 return StreamUtils .copyToString (connection .getInputStream (), StandardCharsets .UTF_8 );
104104 }
105+ //ds-snippet-end:eSign10Step4
105106
106107 private static void writeBoundaryHeader (
107108 DataOutputStream buffer ,
@@ -136,6 +137,7 @@ private static void writeClosingBoundary(DataOutputStream buffer) throws IOExcep
136137 // recipient 2 - cc
137138 // The envelope will be sent first to the signer.
138139 // After it is signed, a copy is sent to the cc person.
140+ //ds-snippet-start:eSign10Step3
139141 private static JSONObject makeEnvelopeJSON (
140142 String signerName ,
141143 String signerEmail ,
@@ -189,6 +191,7 @@ private static JSONObject makeEnvelopeJSON(
189191
190192 return envelopeJSON ;
191193 }
194+ //ds-snippet-end:eSign10Step3
192195 @ Value
193196 public static class DocumentInfo {
194197 String name ;
0 commit comments