This repository was archived by the owner on Oct 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathUnclaimedDraftCreate.java
More file actions
74 lines (62 loc) · 2.82 KB
/
UnclaimedDraftCreate.java
File metadata and controls
74 lines (62 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import com.dropbox.sign.ApiClient;
import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.HttpBasicAuth;
import com.dropbox.sign.model.*;
import java.io.File;
import java.util.List;
import java.util.Map;
public class Example {
public static void main(String[] args) {
ApiClient apiClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: api_key
HttpBasicAuth apiKey = (HttpBasicAuth) apiClient
.getAuthentication("api_key");
apiKey.setUsername("YOUR_API_KEY");
// or, configure Bearer (JWT) authorization: oauth2
/*
HttpBearerAuth oauth2 = (HttpBearerAuth) apiClient
.getAuthentication("oauth2");
oauth2.setBearerToken("YOUR_ACCESS_TOKEN");
*/
UnclaimedDraftApi unclaimedDraftApi = new UnclaimedDraftApi(apiClient);
SubUnclaimedDraftSigner signer1 = new SubUnclaimedDraftSigner()
.emailAddress("jack@example.com")
.name("Jack")
.order(0);
SubUnclaimedDraftSigner signer2 = new SubUnclaimedDraftSigner()
.emailAddress("jill@example.com")
.name("Jill")
.order(1);
SubSigningOptions subSigningOptions = new SubSigningOptions()
.draw(true)
.type(true)
.upload(true)
.phone(false)
.defaultType(SubSigningOptions.DefaultTypeEnum.DRAW);
SubFieldOptions subFieldOptions = new SubFieldOptions()
.dateFormat(SubFieldOptions.DateFormatEnum.DD_MM_YYYY);
UnclaimedDraftCreateRequest data = new UnclaimedDraftCreateRequest()
.subject("The NDA we talked about")
.type(UnclaimedDraftCreateRequest.TypeEnum.REQUEST_SIGNATURE)
.message("Please sign this NDA and then we can discuss more. Let me know if you have any questions.")
.signers(List.of(signer1, signer2))
.ccEmailAddresses(List.of("lawyer@dropboxsign.com", "lawyer@dropboxsign.com"))
.addFilesItem(new File("example_signature_request.pdf"));
.metadata(Map.of("custom_id", 1234, "custom_text", "NDA #9"))
.signingOptions(subSigningOptions)
.fieldOptions(subFieldOptions)
.testMode(true);
try {
UnclaimedDraftCreateResponse result = unclaimedDraftApi.unclaimedDraftCreate(data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AccountApi#accountCreate");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}