Reputation: 2673
I'm using the Docusign Java SDK and I'm curious if anyone else noticed it's NOT typesafe. Are there at least constants for the value I can use instead of generic String values.
for example, to send a JSON webhook payload when you use request an envelope signature:
// configure a connect notification
EventNotification eventNotification = new EventNotification();
// Set up the endpoint URL to call (it must be using HTTPS and at least TLS1.1 or higher)
eventNotification.setUrl("my-webhook-url");
// DocuSign will retry on failure if this is set
eventNotification.setRequireAcknowledgment("true"); <---- the String "true"?????
// This would send the documents together with the event to the endpoint
eventNotification.setIncludeDocuments("false"); <---- the String "false"?????
// Allows you to see this in the DocuSign Admin Connect logs section
eventNotification.setLoggingEnabled("true"); <---- the String "true"?????
// send an event when the envelope is sent and completed.
EnvelopeEvent sentEvent = new EnvelopeEvent();
sentEvent.setEnvelopeEventStatusCode("Sent"); <---- the String "Sent"?????
sentEvent.setIncludeDocuments("false");
EnvelopeEvent completedEvent = new EnvelopeEvent();
completedEvent.setEnvelopeEventStatusCode("Completed"); <---- the String "Completed"?????
completedEvent.setIncludeDocuments("false");
eventNotification.setEnvelopeEvents(List.of(sentEvent, completedEvent));
ConnectEventData eventData = new ConnectEventData();
eventData.setVersion("restv2.1"); <---- surely these should be constants....right?
eventData.setFormat("json"); <----
eventNotification.setEventData(eventData);
envelope.setEventNotification(eventNotification);
this documentation led me to use Strings like envelope-completed
instead of Completed
....which cost me hours of trial and error.
Isn't the whole point of an SDK in a language like Java to be type safe? What am I missing here?
Upvotes: 1
Views: 118
Reputation: 14050
This is not an issue with the Java SDK, but with the swagger file that has definitions for various fields in the DocuSign eSignature REST API.
The swagger file defines many things as strings, even if they do not have to be strings. Changing this now would be a breaking change for many integrations and developers that rely on this (buggy or not) behavior.
This may be fixed in a new version of the API to avoid having backward compatibility issues.
Upvotes: 1