Skip to content

Commit ab77bfb

Browse files
Merge pull request #175 from docusign/DEVDOCS-18396
Devdocs 18396
2 parents 2a66a0a + 63a542f commit ab77bfb

2 files changed

Lines changed: 29 additions & 36 deletions

File tree

src/main/java/com/docusign/controller/workspaces/examples/Work003SendEnvelopeWithRecipientController.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,15 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception
3838
@Override
3939
protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception {
4040
var accountId = session.getAccountId();
41-
42-
//ds-snippet-start:Workspaces3Step2
4341
var accessToken = user.getAccessToken();
44-
//ds-snippet-end:Workspaces3Step2
45-
4642
var basePath = session.getBasePath();
4743
var workspaceId = session.getWorkspaceId();
48-
49-
//ds-snippet-start:Workspaces3Step3
5044
var documentId = session.getDocumentId();
51-
//ds-snippet-end:Workspaces3Step3
52-
5345
var signerEmail = args.getSignerEmail();
5446
var signerName = args.getSignerName();
55-
56-
//ds-snippet-start:Workspaces3Step4
5747
var envelope = SendEnvelopeWithRecipientInfoService.createWorkspaceEnvelope(accessToken, accountId, workspaceId, documentId);
58-
//ds-snippet-end:Workspaces3Step4
59-
60-
//ds-snippet-start:Workspaces3Step5
6148
var envelopeId = envelope.createWorkspaceEnvelopeResponse().get().envelopeId().get();
62-
//ds-snippet-end:Workspaces3Step5
63-
64-
//ds-snippet-start:Workspaces3Step6
6549
var results = SendEnvelopeWithRecipientInfoService.sendEnvelope(accessToken, basePath, accountId, envelopeId, signerEmail, signerName);
66-
//ds-snippet-end:Workspaces3Step6
6750

6851
DoneExample.createDefault(getTextForCodeExampleByApiType().ExampleName)
6952
.withMessage(getTextForCodeExampleByApiType().ResultsPageText.replaceFirst("\\{0}", envelopeId))

src/main/java/com/docusign/controller/workspaces/services/SendEnvelopeWithRecipientInfoService.java

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,26 @@ public final class SendEnvelopeWithRecipientInfoService {
2525
private static final int ANCHOR_OFFSET_Y = 10;
2626

2727
private static final int ANCHOR_OFFSET_X = 20;
28-
28+
29+
//ds-snippet-start:Workspaces3Step2
2930
private static IamClient createIamClient(String accessToken) {
3031
return IamClient.builder().accessToken(accessToken).build();
3132
}
33+
//ds-snippet-end:Workspaces3Step2
3234

3335
public static CreateWorkspaceEnvelopeResponse createWorkspaceEnvelope(
3436
String accessToken,
3537
String accountId,
3638
String workspaceId,
3739
String documentId) throws Exception {
3840

41+
//ds-snippet-start:Workspaces3Step3
3942
var workspaceEnvelopeForCreate = new WorkspaceEnvelopeForCreate();
4043
workspaceEnvelopeForCreate.withEnvelopeName(ENVELOPE_NAME);
4144
workspaceEnvelopeForCreate.withDocumentIds(Arrays.asList(documentId));
42-
45+
//ds-snippet-end:Workspaces3Step3
46+
47+
//ds-snippet-start:Workspaces3Step4
4348
return createIamClient(accessToken)
4449
.workspaces()
4550
.workspaces()
@@ -48,25 +53,10 @@ public static CreateWorkspaceEnvelopeResponse createWorkspaceEnvelope(
4853
.workspaceId(workspaceId)
4954
.workspaceEnvelopeForCreate(workspaceEnvelopeForCreate)
5055
.call();
56+
//ds-snippet-end:Workspaces3Step4
5157
}
5258

53-
public static EnvelopeUpdateSummary sendEnvelope(
54-
String accessToken,
55-
String basePath,
56-
String accountId,
57-
String envelopeId,
58-
String signerEmail,
59-
String signerName
60-
) throws ApiException {
61-
var client = new ApiClient(basePath);
62-
client.addDefaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
63-
var envelopesApi = new EnvelopesApi(client);
64-
65-
var envelope = makeEnvelope(signerEmail, signerName);
66-
67-
return envelopesApi.update(accountId, envelopeId, envelope);
68-
}
69-
59+
//ds-snippet-start:Workspaces3Step5
7060
private static Envelope makeEnvelope(
7161
String signerEmail,
7262
String signerName
@@ -87,4 +77,24 @@ private static Envelope makeEnvelope(
8777

8878
return envelope;
8979
}
80+
//ds-snippet-end:Workspaces3Step5
81+
82+
//ds-snippet-start:Workspaces3Step6
83+
public static EnvelopeUpdateSummary sendEnvelope(
84+
String accessToken,
85+
String basePath,
86+
String accountId,
87+
String envelopeId,
88+
String signerEmail,
89+
String signerName
90+
) throws ApiException {
91+
var client = new ApiClient(basePath);
92+
client.addDefaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
93+
var envelopesApi = new EnvelopesApi(client);
94+
95+
var envelope = makeEnvelope(signerEmail, signerName);
96+
97+
return envelopesApi.update(accountId, envelopeId, envelope);
98+
}
99+
//ds-snippet-end:Workspaces3Step6
90100
}

0 commit comments

Comments
 (0)