From c613d6ea7a66067baf313ffa093fd492882631ae Mon Sep 17 00:00:00 2001 From: Ihor Cherkashyn Date: Mon, 20 Apr 2026 20:08:21 +0200 Subject: [PATCH] Added missing response fields, execute examples --- .env.example | 1 + .gitignore | 2 + Makefile | 14 +- README.md | 2 +- examples/AuthCheckExample.java | 11 +- examples/BulkInviteExample.java | 14 +- examples/DocumentGetExample.java | 23 +- examples/DocumentGroupInviteExample.java | 27 ++- examples/DocumentGroupRecipientsExample.java | 183 +++++++++----- examples/DocumentGroupTemplateExample.java | 19 +- ...mentGroupTemplateRecipientsGetExample.java | 41 ++++ ...mentGroupTemplateRecipientsPutExample.java | 70 ++++++ examples/DocumentPrefillTextFieldExample.java | 15 +- examples/DocumentUploadExample.java | 10 +- examples/DownloadDocumentExample.java | 10 +- examples/DownloadDocumentGroupExample.java | 14 +- examples/EmbeddedEditorDocumentExample.java | 11 +- .../EmbeddedEditorDocumentGroupExample.java | 13 +- examples/EmbeddedGroupInviteExample.java | 15 +- examples/EmbeddedInviteExample.java | 19 +- examples/EmbeddedSendingDocumentExample.java | 13 +- .../EmbeddedSendingDocumentGroupExample.java | 14 +- examples/FieldInviteExample.java | 18 +- examples/FolderExample.java | 10 +- examples/FolderRootExample.java | 8 +- examples/FreeFormInviteExample.java | 14 +- examples/README.md | 53 +++++ examples/SignNowExampleData.java | 182 ++++++++++++++ examples/SigningLinkExample.java | 28 ++- examples/TemplateExample.java | 10 +- examples/UserInfoExample.java | 8 +- examples/WebhookExample.java | 34 +-- examples/bin/run | 73 ++++++ examples/files/bulk_demo.csv | 1 + examples/files/demo.pdf | Bin 0 -> 4911 bytes examples/signnow-example.properties.empty | 65 +++++ examples/signnow-example.properties.example | 98 ++++++++ .../response/DocumentGetResponse.java | 58 ++++- .../response/data/GeneralReminder.java | 84 +++++++ .../DocumentGroupRecipientsPutRequest.java | 96 +++++++- .../request/data/GeneralReminder.java | 109 +++++++++ .../request/data/recipient/Attribute.java | 223 ++++++++++++------ .../response/DocumentGroupGetResponse.java | 58 ++++- .../response/data/data/Data.java | 65 ++++- .../response/data/data/GeneralReminder.java | 119 ++++++++++ ...mentGroupTemplateRecipientsGetRequest.java | 69 ++++++ ...mentGroupTemplateRecipientsPutRequest.java | 168 +++++++++++++ ...entGroupTemplateRecipientsGetResponse.java | 45 ++++ ...entGroupTemplateRecipientsPutResponse.java | 45 ++++ .../response/data/document/FieldDocument.java | 24 +- .../response/data/document/JsonAttribute.java | 24 +- .../response/data/premiumaccess/Plan.java | 24 +- .../request/SubscriptionDeleteRequest.java | 3 +- src/main/java/com/signnow/core/ApiClient.java | 7 +- .../signnow/core/config/ConfigRepository.java | 7 +- .../com/signnow/core/data/ResponseData.java | 34 +++ .../java/com/signnow/core/response/Reply.java | 42 +++- .../signnow/core/response/ResponseParser.java | 4 +- .../DocumentGroupTemplateRecipientsTest.java | 93 ++++++++ .../core/config/ConfigRepositoryTest.java | 1 + src/test/resources/.env.test | 2 +- src/test/resources/mock_config.env | 1 + .../wiremock/mappings/get_document_get.json | 4 +- .../mappings/get_document_group_get.json | 4 +- .../get_document_group_recipients_get.json | 4 +- ...ocument_group_template_recipients_get.json | 13 + .../wiremock/mappings/get_user_info_get.json | 4 +- .../update_document_group_recipients_put.json | 4 +- ...ocument_group_template_recipients_put.json | 13 + 69 files changed, 2237 insertions(+), 357 deletions(-) create mode 100644 examples/DocumentGroupTemplateRecipientsGetExample.java create mode 100644 examples/DocumentGroupTemplateRecipientsPutExample.java create mode 100644 examples/README.md create mode 100644 examples/SignNowExampleData.java create mode 100755 examples/bin/run create mode 100644 examples/files/bulk_demo.csv create mode 100644 examples/files/demo.pdf create mode 100644 examples/signnow-example.properties.empty create mode 100644 examples/signnow-example.properties.example create mode 100644 src/main/java/com/signnow/api/document/response/data/GeneralReminder.java create mode 100644 src/main/java/com/signnow/api/documentgroup/request/data/GeneralReminder.java create mode 100644 src/main/java/com/signnow/api/documentgroup/response/data/data/GeneralReminder.java create mode 100644 src/main/java/com/signnow/api/documentgrouptemplate/request/DocumentGroupTemplateRecipientsGetRequest.java create mode 100644 src/main/java/com/signnow/api/documentgrouptemplate/request/DocumentGroupTemplateRecipientsPutRequest.java create mode 100644 src/main/java/com/signnow/api/documentgrouptemplate/response/DocumentGroupTemplateRecipientsGetResponse.java create mode 100644 src/main/java/com/signnow/api/documentgrouptemplate/response/DocumentGroupTemplateRecipientsPutResponse.java create mode 100644 src/test/java/com/signnow/api/documentgrouptemplate/DocumentGroupTemplateRecipientsTest.java create mode 100644 src/test/resources/wiremock/mappings/get_document_group_template_recipients_get.json create mode 100644 src/test/resources/wiremock/mappings/update_document_group_template_recipients_put.json diff --git a/.env.example b/.env.example index f048b51..0419780 100644 --- a/.env.example +++ b/.env.example @@ -7,6 +7,7 @@ SIGNNOW_API_HOST=https://api.signnow.com SIGNNOW_API_BASIC_TOKEN=c2lnbk5vdyBBUEkgc2FtcGxlIEFwcCB2MS4wCg== SIGNNOW_API_USERNAME=user@signnow.com SIGNNOW_API_PASSWORD=coolest_pazzw0rd +SIGNNOW_API_TIMEOUT=30 # Absolute or relative (starts with .) path to the directory # where the downloaded files will be stored (make sure you have write permissions to this directory) diff --git a/.gitignore b/.gitignore index 620b615..b86e4ec 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ .env.backup .env.production .env.development +examples/signnow-example.properties +examples/files/bulk_real.csv diff --git a/Makefile b/Makefile index 2ec77cc..2be54db 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: mock-up mock-stop mock-restart test tests +.PHONY: mock-up mock-stop mock-restart test tests example examples .SILENT: ; # no need for @ .ONESHELL: ; # recipes execute in same shell @@ -34,3 +34,15 @@ test: # Run all the tests tests: mvn test + +# Run an example from examples/ directory +# Examples: +# make example E=DocumentGetExample +# make examples +example: + @if [ -z "$(E)" ]; then echo "Usage: make example E=ExampleClassName"; exit 1; fi + ./examples/bin/run $(E) + +# Run all examples +examples: + ./examples/bin/run all diff --git a/README.md b/README.md index 3857b64..61f3807 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # signNow API Java SDK -## v3.5.1 +## v3.5.2 [![Java Version](https://img.shields.io/badge/codebase-java--11-yellowgreen)](https://www.java.com/) diff --git a/examples/AuthCheckExample.java b/examples/AuthCheckExample.java index 7187806..986c390 100644 --- a/examples/AuthCheckExample.java +++ b/examples/AuthCheckExample.java @@ -6,13 +6,10 @@ public class AuthCheckExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example - //---------------------------------------------------- - // if it is empty or null, a new Bearer token will be created automatically - String bearerToken = ""; - + // Fill in your actual data in examples/signnow-example.properties before running + //--------------------------------------------------- + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); TokenGetResponse response = (TokenGetResponse) client.send(new TokenGetRequest()).getResponse(); diff --git a/examples/BulkInviteExample.java b/examples/BulkInviteExample.java index 81ae510..3d3e46f 100644 --- a/examples/BulkInviteExample.java +++ b/examples/BulkInviteExample.java @@ -7,29 +7,29 @@ public class BulkInviteExample { public static void main(String[] args) { + // Fill in your actual data in examples/signnow-example.properties before running - // Set your actual input data here - // Note: following values are dummy, just for example // Details: https://docs.signnow.com/docs/signnow/template/operations/create-a-template-bulkinvite //---------------------------------------------------- - // if it is empty or null, a new Bearer token will be created automatically - String bearerToken = ""; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); // CSV file containing information for each invite in the bulk // Example: Signer 1|user@signnow.com,Contract_0_Jack // "Signer 1" - signing role, must present in the template // "user@signnow.com" - signer email related for the signing role // "Contract_0_Jack" - contains 3 parts: "Contract" - document name, 0 - line/invite number, // "Jack" - signer name - String csvFilePath = "/your/path/to/data.csv"; + String csvFilePath = data.getBulkInviteCsvFilePath(); // The template from which a new document will be cloned for each invite in the bulk. // The template must have at least one field assigned the same signing role that exists in your csv file // (i.e. "Signer 1") // Look at TemplateExample.java to find out how to create a template. // Look at FieldInviteExample.java to find out how to add a field to document or template. - String templateId = "e2e913db4ba9815a31c8a28a196b7df96fe1cc46"; + String templateId = data.getBulkInviteTemplateId(); // The folder to store documents cloned from the template. - String folderId = "3073f8da73b9a5328f95ccc55a912e3f46da2d94"; + String folderId = data.getBulkInviteFolderId(); String documentNameClonedFromTemplate = "test_bulk_invite"; + // Set your actual input data here, or use these as examples String bulkInviteSubject = "email subject for all signers from CSV"; String bulkInviteMessage = "email message for all signers from CSV"; diff --git a/examples/DocumentGetExample.java b/examples/DocumentGetExample.java index d23c1d5..7330908 100644 --- a/examples/DocumentGetExample.java +++ b/examples/DocumentGetExample.java @@ -6,13 +6,11 @@ public class DocumentGetExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String documentId = "05fbed799231d85cf3471121ecd6a4221f9c5610"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String documentId = data.getDocumentId(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); @@ -22,6 +20,19 @@ public static void main(String[] args) { System.out.println("Document ID: " + response.getId()); System.out.println("Document Name: " + response.getDocumentName()); System.out.println("Document Owner: " + response.getUserId()); + + // These fields are available when using ?include=field_invites query parameter + if (response.getGeneralExpirationDays() != null) { + System.out.println("General Expiration Days: " + response.getGeneralExpirationDays()); + } + if (response.getGeneralReminder() != null) { + System.out.println("General Reminder - After: " + response.getGeneralReminder().getRemindAfter() + + ", Before: " + response.getGeneralReminder().getRemindBefore() + + ", Repeat: " + response.getGeneralReminder().getRemindRepeat()); + } + if (response.getOrderType() != null) { + System.out.println("Order Type: " + response.getOrderType()); + } } catch (SignNowApiException e) { System.out.println("ERROR: " + e.getMessage()); } diff --git a/examples/DocumentGroupInviteExample.java b/examples/DocumentGroupInviteExample.java index 25c1e86..ee179be 100644 --- a/examples/DocumentGroupInviteExample.java +++ b/examples/DocumentGroupInviteExample.java @@ -19,18 +19,17 @@ public class DocumentGroupInviteExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String pathToDocument = data.getPathToDocument(); + String signerRole = data.getDocumentGroupInviteSignerRole(); + String signerEmail = data.getDocumentGroupInviteSignerEmail(); + // Set your actual input data here, or use these as examples String groupName = "Test Document Group"; - String signerRole = "Signer"; - String signerEmail = "signer@signnow.com"; String subject = "Please sign these documents"; String message = "Hello, please sign these documents"; - String pathToDocument = "/your/path/to/document.pdf"; try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); @@ -103,6 +102,18 @@ public static void main(String[] args) { GroupInvitePostResponse inviteResponse = (GroupInvitePostResponse) client.send(inviteRequest).getResponse(); System.out.println("Document Group: " + docGroupResponse.getId()); + // These fields are available when using ?include=reminder query parameter + if (docGroupResponse.getGeneralExpirationDays() != null) { + System.out.println("General Expiration Days: " + docGroupResponse.getGeneralExpirationDays()); + } + if (docGroupResponse.getGeneralReminder() != null) { + System.out.println("General Reminder - After: " + docGroupResponse.getGeneralReminder().getRemindAfter() + + ", Before: " + docGroupResponse.getGeneralReminder().getRemindBefore() + + ", Repeat: " + docGroupResponse.getGeneralReminder().getRemindRepeat()); + } + if (docGroupResponse.getOrderType() != null) { + System.out.println("Order Type: " + docGroupResponse.getOrderType()); + } System.out.println("Document Group invite: " + inviteResponse.getId()); } catch (SignNowApiException e) { System.out.println("ERROR: " + e.getMessage()); diff --git a/examples/DocumentGroupRecipientsExample.java b/examples/DocumentGroupRecipientsExample.java index 1780ef4..e5257eb 100644 --- a/examples/DocumentGroupRecipientsExample.java +++ b/examples/DocumentGroupRecipientsExample.java @@ -1,8 +1,20 @@ -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import com.signnow.api.document.request.DocumentPostRequest; +import com.signnow.api.document.request.DocumentPutRequest; +import com.signnow.api.document.request.data.Field; +import com.signnow.api.document.request.data.FieldCollection; +import com.signnow.api.document.response.DocumentPostResponse; +import com.signnow.api.documentgroup.request.DocumentGroupGetRequest; +import com.signnow.api.documentgroup.request.DocumentGroupPostRequest; +import com.signnow.api.documentgroup.request.data.DocumentIdCollection; +import com.signnow.api.documentgroup.response.DocumentGroupGetResponse; +import com.signnow.api.documentgroup.response.DocumentGroupPostResponse; import com.signnow.api.documentgroup.request.DocumentGroupRecipientsGetRequest; import com.signnow.api.documentgroup.request.DocumentGroupRecipientsPutRequest; import com.signnow.api.documentgroup.request.data.CcCollection; +import com.signnow.api.documentgroup.request.data.GeneralReminder; +import com.signnow.api.documentgroup.request.data.recipient.Attribute; +import com.signnow.api.documentgroup.request.data.recipient.Document; +import com.signnow.api.documentgroup.request.data.recipient.DocumentCollection; import com.signnow.api.documentgroup.request.data.recipient.Recipient; import com.signnow.api.documentgroup.request.data.recipient.RecipientCollection; import com.signnow.api.documentgroup.response.DocumentGroupRecipientsGetResponse; @@ -10,82 +22,131 @@ import com.signnow.core.ApiClient; import com.signnow.core.exception.SignNowApiException; import com.signnow.core.factory.SdkFactory; +import java.io.File; public class DocumentGroupRecipientsExample { public static void main(String[] args) { - // Set your actual input data here - // Note: following values are dummy, just for example - // ---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String documentGroupId = "5d66ca4accdd4ab28f8b2c71001093b5cb3bcb8a"; + // Fill in your actual data in examples/signnow-example.properties before running + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String pathToDocument = data.getPathToDocument(); + String firstRecipientRole = data.getFirstRecipientRole(); + String secondRecipientRole = data.getSecondRecipientRole(); + String signAction = data.getSignAction(); + String viewAction = data.getViewAction(); + // Set your actual input data here, or use these as examples + String groupName = "Test Document Group Recipients Example"; + String recipientOrder = "recipient_order"; // at_the_same_time, recipient_order, advanced_order + int expirationDays = 31; try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); - // Get recipient - DocumentGroupRecipientsGetRequest request = new DocumentGroupRecipientsGetRequest() - .withDocumentGroupId(documentGroupId); - DocumentGroupRecipientsGetResponse response = (DocumentGroupRecipientsGetResponse) client.send(request) - .getResponse(); + // Precondition: + // the document group contains 2 documents both with a field assigned a signer role + //---------------------------------------------------- + // Step 1: Upload two documents to become a document group + DocumentPostRequest request = new DocumentPostRequest(new File(pathToDocument)); + DocumentPostResponse response = (DocumentPostResponse) client.send(request).getResponse(); + String documentId1 = response.getId(); + // Step 2: Add fields with roles to the 1st document + FieldCollection fields = new FieldCollection(); + fields.add( + new Field(205, 18, 122, 12, "text", 0, true, firstRecipientRole, "text_field1", "Reason to sign")); + DocumentPutRequest putRequest1 = new DocumentPutRequest(fields); + putRequest1.withDocumentId(documentId1); + client.send(putRequest1); + // Step 3: Upload 2nd document + DocumentPostRequest request2 = new DocumentPostRequest(new File(pathToDocument)); + DocumentPostResponse response2 = (DocumentPostResponse) client.send(request2).getResponse(); + String documentId2 = response2.getId(); + // Step 4: Add fields and roles to the 2nd document + FieldCollection fields2 = new FieldCollection(); + fields2.add( + new Field(220, 24, 142, 14, "text", 0, true, secondRecipientRole, "text_field2", "My reason")); + DocumentPutRequest putRequest2 = new DocumentPutRequest(fields2); + putRequest2.withDocumentId(documentId2); + client.send(putRequest2); + // Step 5: Create document group + DocumentIdCollection documentIds = new DocumentIdCollection(); + documentIds.add(documentId1); + documentIds.add(documentId2); + DocumentGroupPostRequest groupRequest = new DocumentGroupPostRequest(documentIds, groupName); + DocumentGroupPostResponse groupResponse = + (DocumentGroupPostResponse) client.send(groupRequest).getResponse(); + String documentGroupId = groupResponse.getId(); - // Convert to request model and replace email - RecipientCollection recipientCollection = new RecipientCollection(); - for (com.signnow.api.documentgroup.response.data.data.Recipient responseRecipient : response.getData() - .getRecipients()) { - Recipient reqRecipient = convertRecipient(responseRecipient); - if (reqRecipient == null) continue; - - System.out.println("Original name: " + responseRecipient.getName()); - System.out.println("Original email: " + responseRecipient.getEmail()); + // PUT /v2/document-groups/{document_group_id}/recipients + DocumentCollection docs1 = new DocumentCollection(); + // Signer recipient: should review and sign the document + docs1.add(new Document(documentId1, firstRecipientRole, signAction)); + Attribute signerAttribute = Attribute.signer(false, true, false, "Please sign", "Signing request", null, null, null); + Recipient recipient1 = new Recipient("John Doe", "john.doe@example.com", 1, docs1, null, signerAttribute); - if (reqRecipient.getName().equals("Recipient 1")) { - // Replace email - Recipient updated = new Recipient( - reqRecipient.getName(), - "new.email@example.com", - reqRecipient.getOrder(), - reqRecipient.getDocuments(), - reqRecipient.getEmailGroup(), - reqRecipient.getAttributes()); - recipientCollection.add(updated); - } else { - recipientCollection.add(reqRecipient); - } - } + DocumentCollection docs2 = new DocumentCollection(); + // Viewer recipient: no signature, only view the document + docs2.add(new Document(documentId2, secondRecipientRole, viewAction)); + Attribute viewerAttribute = Attribute.viewer("Please review", "Document review", false, null, null, null, null); + Recipient recipient2 = new Recipient("Jane Smith", "jane.smith@example.com", 2, docs2, null, viewerAttribute); + + RecipientCollection recipients = new RecipientCollection(); + recipients.add(recipient1); + recipients.add(recipient2); + + GeneralReminder generalReminder = new GeneralReminder(1, 5, 3); - // Send PUT request DocumentGroupRecipientsPutRequest putRequest = new DocumentGroupRecipientsPutRequest( - recipientCollection, - new CcCollection()).withDocumentGroupId(documentGroupId); + recipients, + new CcCollection(), + expirationDays, + generalReminder, + recipientOrder + ).withDocumentGroupId(documentGroupId); DocumentGroupRecipientsPutResponse putResponse = (DocumentGroupRecipientsPutResponse) client.send(putRequest) .getResponse(); - System.out.println("Updated email: " + putResponse.getData().getRecipients().get(0).getEmail()); + System.out.println("==== PUT ===="); + System.out.println("Updated recipients:"); + putResponse.getData().getRecipients().forEach(r -> { + System.out.println(" Name: " + r.getName() + ", Email: " + r.getEmail()); + }); + if (putResponse.getData().getGeneralExpirationDays() != null) { + System.out.println("General Expiration Days: " + putResponse.getData().getGeneralExpirationDays()); + } + if (putResponse.getData().getGeneralReminder() != null) { + com.signnow.api.documentgroup.response.data.data.GeneralReminder responseReminder = putResponse.getData().getGeneralReminder(); + System.out.println("General Reminder - After: " + responseReminder.getRemindAfter() + + ", Before: " + responseReminder.getRemindBefore() + + ", Repeat: " + responseReminder.getRemindRepeat()); + } + if (putResponse.getData().getOrderType() != null) { + System.out.println("Order Type: " + putResponse.getData().getOrderType()); + } + // GET /v2/document-groups/{document_group_id}/recipients + System.out.println("==== GET ===="); + DocumentGroupRecipientsGetRequest getRequest = new DocumentGroupRecipientsGetRequest() + .withDocumentGroupId(documentGroupId); + DocumentGroupRecipientsGetResponse getResponse = (DocumentGroupRecipientsGetResponse) client.send(getRequest) + .getResponse(); + System.out.println("Recipients:"); + getResponse.getData().getRecipients().forEach(r -> { + System.out.println(" Name: " + r.getName() + ", Email: " + r.getEmail()); + }); + if (getResponse.getData().getGeneralExpirationDays() != null) { + System.out.println("General Expiration Days: " + getResponse.getData().getGeneralExpirationDays()); + } + if (getResponse.getData().getGeneralReminder() != null) { + com.signnow.api.documentgroup.response.data.data.GeneralReminder responseReminder = getResponse.getData().getGeneralReminder(); + System.out.println("General Reminder - After: " + responseReminder.getRemindAfter() + + ", Before: " + responseReminder.getRemindBefore() + + ", Repeat: " + responseReminder.getRemindRepeat()); + } + if (getResponse.getData().getOrderType() != null) { + System.out.println("Order Type: " + getResponse.getData().getOrderType()); + } } catch (SignNowApiException e) { System.out.println("ERROR: " + e.getMessage()); } } - - private static Recipient convertRecipient( - com.signnow.api.documentgroup.response.data.data.Recipient responseRecipient) { - ObjectMapper mapper = new ObjectMapper(); - try { - String json = mapper.writeValueAsString(responseRecipient); - Recipient recipient = mapper.readValue(json, Recipient.class); - - return new Recipient( - recipient.getName(), - recipient.getEmail(), - recipient.getOrder(), - recipient.getDocuments(), - recipient.getEmailGroup(), - recipient.getAttributes()); - - } catch (JsonProcessingException e) { - e.printStackTrace(); - return null; - } - } } diff --git a/examples/DocumentGroupTemplateExample.java b/examples/DocumentGroupTemplateExample.java index b9f92d9..c791602 100644 --- a/examples/DocumentGroupTemplateExample.java +++ b/examples/DocumentGroupTemplateExample.java @@ -3,19 +3,22 @@ import com.signnow.core.ApiClient; import com.signnow.core.exception.SignNowApiException; import com.signnow.core.factory.SdkFactory; +import java.time.Instant; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; public class DocumentGroupTemplateExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String templateGroupId = "5d66ca4accdd4ab28f8b2c71001093b5cb3bcb8a"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String templateGroupId = data.getDocumentGroupTemplateTemplateGroupId(); + String clientTimestamp = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'") + .withZone(ZoneOffset.UTC).format(Instant.now()); + String folderId = data.getDocumentGroupTemplateFolderId(); + // Set your actual input data here, or use these as examples String groupName = "My Document Group"; - String clientTimestamp = "2024-01-15T10:30:00Z"; - String folderId = "5d66ca4accdd4ab28f8b2c71001093b5cb3bcb8b"; try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/DocumentGroupTemplateRecipientsGetExample.java b/examples/DocumentGroupTemplateRecipientsGetExample.java new file mode 100644 index 0000000..a74845b --- /dev/null +++ b/examples/DocumentGroupTemplateRecipientsGetExample.java @@ -0,0 +1,41 @@ +import com.signnow.api.documentgrouptemplate.request.DocumentGroupTemplateRecipientsGetRequest; +import com.signnow.api.documentgrouptemplate.response.DocumentGroupTemplateRecipientsGetResponse; +import com.signnow.core.ApiClient; +import com.signnow.core.exception.SignNowApiException; +import com.signnow.core.factory.SdkFactory; + +public class DocumentGroupTemplateRecipientsGetExample { + public static void main(String[] args) { + // Fill in your actual data in examples/signnow-example.properties before running + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String templateId = data.getDocumentGroupTemplateRecipientsTemplateId(); + + try { + ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); + DocumentGroupTemplateRecipientsGetRequest request = + new DocumentGroupTemplateRecipientsGetRequest().withTemplateId(templateId); + DocumentGroupTemplateRecipientsGetResponse response = + (DocumentGroupTemplateRecipientsGetResponse) client.send(request).getResponse(); + + System.out.println("Template Recipients:"); + response.getData().getRecipients().forEach(recipient -> { + System.out.println(" Name: " + recipient.getName() + ", Email: " + recipient.getEmail()); + }); + + if (response.getData().getGeneralExpirationDays() != null) { + System.out.println("General Expiration Days: " + response.getData().getGeneralExpirationDays()); + } + if (response.getData().getGeneralReminder() != null) { + System.out.println("General Reminder - After: " + response.getData().getGeneralReminder().getRemindAfter() + + ", Before: " + response.getData().getGeneralReminder().getRemindBefore() + + ", Repeat: " + response.getData().getGeneralReminder().getRemindRepeat()); + } + if (response.getData().getOrderType() != null) { + System.out.println("Order Type: " + response.getData().getOrderType()); + } + } catch (SignNowApiException e) { + System.out.println("ERROR: " + e.getMessage()); + } + } +} diff --git a/examples/DocumentGroupTemplateRecipientsPutExample.java b/examples/DocumentGroupTemplateRecipientsPutExample.java new file mode 100644 index 0000000..85f4f46 --- /dev/null +++ b/examples/DocumentGroupTemplateRecipientsPutExample.java @@ -0,0 +1,70 @@ +import com.signnow.api.documentgroup.request.data.CcCollection; +import com.signnow.api.documentgroup.request.data.GeneralReminder; +import com.signnow.api.documentgroup.request.data.recipient.Attribute; +import com.signnow.api.documentgroup.request.data.recipient.Document; +import com.signnow.api.documentgroup.request.data.recipient.DocumentCollection; +import com.signnow.api.documentgroup.request.data.recipient.Recipient; +import com.signnow.api.documentgroup.request.data.recipient.RecipientCollection; +import com.signnow.api.documentgrouptemplate.request.DocumentGroupTemplateRecipientsGetRequest; +import com.signnow.api.documentgrouptemplate.request.DocumentGroupTemplateRecipientsPutRequest; +import com.signnow.api.documentgrouptemplate.response.DocumentGroupTemplateRecipientsGetResponse; +import com.signnow.api.documentgrouptemplate.response.DocumentGroupTemplateRecipientsPutResponse; +import com.signnow.core.ApiClient; +import com.signnow.core.exception.SignNowApiException; +import com.signnow.core.factory.SdkFactory; + +public class DocumentGroupTemplateRecipientsPutExample { + public static void main(String[] args) { + // Fill in your actual data in examples/signnow-example.properties before running + // ---------------------------------------------------- + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String templateId = data.getDocumentGroupTemplateRecipientsTemplateId(); + String documentId1 = data.getDocumentGroupTemplateRecipientsDocumentId1(); + // Set your actual input data here, or use these as examples + String orderType = "recipient_order"; // at_the_same_time, recipient_order, advanced_order + int expirationDays = 30; + + try { + ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); + + // Recipient 1 + DocumentCollection docs1 = new DocumentCollection(); + docs1.add(new Document(documentId1, "Recipient 1", "sign")); + Attribute attr1 = Attribute.signer(false, true, false, "Please sign", "Signing request", null, null, null); + Recipient recipient1 = new Recipient("John Doe", "abuba@yopmail.com", 1, docs1, null, attr1); + + // Update template recipients with general settings + RecipientCollection recipients = new RecipientCollection(); + recipients.add(recipient1); + CcCollection cc = new CcCollection(); + + GeneralReminder generalReminder = new GeneralReminder(1, 5, 3); + + DocumentGroupTemplateRecipientsPutRequest putRequest = + new DocumentGroupTemplateRecipientsPutRequest( + recipients, + cc, + expirationDays, + generalReminder, + orderType + ).withTemplateId(templateId); + + DocumentGroupTemplateRecipientsPutResponse putResponse = + (DocumentGroupTemplateRecipientsPutResponse) client.send(putRequest).getResponse(); + + System.out.println("Template recipients updated successfully."); + if (putResponse.getData().getGeneralExpirationDays() != null) { + System.out.println("General expiration: " + putResponse.getData().getGeneralExpirationDays()); + } + if (putResponse.getData().getGeneralReminder() != null) { + System.out.println("General reminder: " + putResponse.getData().getGeneralReminder()); + } + if (putResponse.getData().getOrderType() != null) { + System.out.println("Updated Order Type: " + putResponse.getData().getOrderType()); + } + } catch (SignNowApiException e) { + System.out.println("ERROR: " + e.getMessage()); + } + } +} diff --git a/examples/DocumentPrefillTextFieldExample.java b/examples/DocumentPrefillTextFieldExample.java index d0cf0fe..9ef5275 100644 --- a/examples/DocumentPrefillTextFieldExample.java +++ b/examples/DocumentPrefillTextFieldExample.java @@ -1,3 +1,4 @@ +import com.signnow.api.document.request.DocumentPutRequest; import com.signnow.api.document.request.DocumentPostRequest; import com.signnow.api.document.response.DocumentPostResponse; import com.signnow.api.documentfield.request.DocumentPrefillPutRequest; @@ -7,16 +8,16 @@ import com.signnow.core.factory.SdkFactory; import com.signnow.api.documentfield.request.data.*; import com.signnow.core.response.Reply; +import java.io.File; + public class DocumentPrefillTextFieldExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String signerRole = "Product Manager"; - String pathToDocument = "/your/path/to/file.pdf"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String signerRole = data.getDocumentPrefillTextFieldSignerRole(); + String pathToDocument = data.getPathToDocument(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/DocumentUploadExample.java b/examples/DocumentUploadExample.java index 7839fc2..cd0007e 100644 --- a/examples/DocumentUploadExample.java +++ b/examples/DocumentUploadExample.java @@ -7,13 +7,11 @@ public class DocumentUploadExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String pathToDocument = "/your/path/to/file.pdf"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String pathToDocument = data.getPathToDocument(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/DownloadDocumentExample.java b/examples/DownloadDocumentExample.java index ba2a1d4..2c31520 100644 --- a/examples/DownloadDocumentExample.java +++ b/examples/DownloadDocumentExample.java @@ -3,15 +3,15 @@ import com.signnow.core.ApiClient; import com.signnow.core.exception.SignNowApiException; import com.signnow.core.factory.SdkFactory; +import java.io.File; public class DownloadDocumentExample { public static void main(String[] args) { - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String documentId = "05fbed799231d85cf3471121ecd6a4221f9c5610"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String documentId = data.getDocumentId(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/DownloadDocumentGroupExample.java b/examples/DownloadDocumentGroupExample.java index 01fa8fa..c4b33b1 100644 --- a/examples/DownloadDocumentGroupExample.java +++ b/examples/DownloadDocumentGroupExample.java @@ -4,17 +4,17 @@ import com.signnow.core.ApiClient; import com.signnow.core.exception.SignNowApiException; import com.signnow.core.factory.SdkFactory; +import java.io.File; public class DownloadDocumentGroupExample { public static void main(String[] args) { - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String documentGroupId = "e1b4c8a2f930d7e6a5b1f4c3d8a09e2b7c5d1f0a"; - String documentId1 = "05fbed799231d85cf3471121ecd6a4221f9c5610"; - String documentId2 = "9a3b1e4f0c2d7a8e5f6b9c1d3e0a4b7c8f2d6a9e"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String documentGroupId = data.getDownloadDocumentGroupDocumentGroupId(); + String documentId1 = data.getDownloadDocumentGroupDocumentId1(); + String documentId2 = data.getDownloadDocumentGroupDocumentId2(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/EmbeddedEditorDocumentExample.java b/examples/EmbeddedEditorDocumentExample.java index 4281036..35c350c 100644 --- a/examples/EmbeddedEditorDocumentExample.java +++ b/examples/EmbeddedEditorDocumentExample.java @@ -10,12 +10,11 @@ public class EmbeddedEditorDocumentExample { public static void main(String[] args) { - // Set your actual input data here - // Note: following values are dummy, just for example - // ---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String pathToDocument = "/your/path/to/file.pdf"; + // Fill in your actual data in examples/signnow-example.properties before running + //---------------------------------------------------- + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String pathToDocument = data.getPathToDocument(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/EmbeddedEditorDocumentGroupExample.java b/examples/EmbeddedEditorDocumentGroupExample.java index 2bf62bb..4eaf2aa 100644 --- a/examples/EmbeddedEditorDocumentGroupExample.java +++ b/examples/EmbeddedEditorDocumentGroupExample.java @@ -13,14 +13,13 @@ public class EmbeddedEditorDocumentGroupExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example - // ---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; + // Fill in your actual data in examples/signnow-example.properties before running + //---------------------------------------------------- + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String pathToDocument = data.getPathToDocument(); + // Set your actual input data here, or use these as examples String groupName = "Test Document Group"; - String pathToDocument = "/your/path/to/file.pdf"; try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/EmbeddedGroupInviteExample.java b/examples/EmbeddedGroupInviteExample.java index 7e9de96..311c89b 100644 --- a/examples/EmbeddedGroupInviteExample.java +++ b/examples/EmbeddedGroupInviteExample.java @@ -18,18 +18,17 @@ public class EmbeddedGroupInviteExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String signer1Email = data.getEmbeddedGroupInviteSigner1Email(); + String signer2Email = data.getEmbeddedGroupInviteSigner2Email(); + String pathToDocument = data.getPathToDocument(); + // Set your actual input data here, or use these as examples String groupName = "Test Document Group for Embedded Invite"; String signer1Role = "Signer 1"; String signer2Role = "Signer 2"; - String signer1Email = "first@signnow.com"; - String signer2Email = "second@signnow.com"; - String pathToDocument = "/your/path/to/document.pdf"; try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/EmbeddedInviteExample.java b/examples/EmbeddedInviteExample.java index c5c8034..84edd3e 100644 --- a/examples/EmbeddedInviteExample.java +++ b/examples/EmbeddedInviteExample.java @@ -22,18 +22,17 @@ public class EmbeddedInviteExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String signerRole = "Signer 1"; - String signerEmail = "first@signnow.com"; - String signerFirstName = "Alex"; - String signerLastName = "Tester"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String signerRole = data.getEmbeddedInviteSignerRole(); + String signerEmail = data.getEmbeddedInviteSignerEmail(); + String signerFirstName = data.getEmbeddedInviteSignerFirstName(); + String signerLastName = data.getEmbeddedInviteSignerLastName(); + String pathToDocument = data.getPathToDocument(); + // Set your actual input data here, or use these as examples int embeddedInviteLinkExpirationTime = 45; - String pathToDocument = "/your/path/to/document.pdf"; try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/EmbeddedSendingDocumentExample.java b/examples/EmbeddedSendingDocumentExample.java index d08bf30..adf4c94 100644 --- a/examples/EmbeddedSendingDocumentExample.java +++ b/examples/EmbeddedSendingDocumentExample.java @@ -10,14 +10,11 @@ public class EmbeddedSendingDocumentExample { public static void main(String[] args) { - - /** - * Important: - * - The following variables are dummy, for example purposes only. Please provide actual data. - * - If you do not specify a Bearer token, it will be generated automatically. - */ - String bearerToken = ""; - String pathToDocument = "/your/path/to/document.pdf"; + // Fill in your actual data in examples/signnow-example.properties before running + //---------------------------------------------------- + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String pathToDocument = data.getPathToDocument(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/EmbeddedSendingDocumentGroupExample.java b/examples/EmbeddedSendingDocumentGroupExample.java index 22ea4fb..63d7842 100644 --- a/examples/EmbeddedSendingDocumentGroupExample.java +++ b/examples/EmbeddedSendingDocumentGroupExample.java @@ -13,15 +13,13 @@ public class EmbeddedSendingDocumentGroupExample { public static void main(String[] args) { - - /** - * Important: - * - The following variables are dummy, for example purposes only. Please provide actual data. - * - If you do not specify a Bearer token, it will be generated automatically. - */ - String bearerToken = ""; + // Fill in your actual data in examples/signnow-example.properties before running + //---------------------------------------------------- + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + // Set your actual input data here, or use these as examples String groupName = "Test Document Group"; - String pathToDocument = "/your/path/to/file.pdf"; + String pathToDocument = data.getPathToDocument(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/FieldInviteExample.java b/examples/FieldInviteExample.java index 603b9e8..289ef86 100644 --- a/examples/FieldInviteExample.java +++ b/examples/FieldInviteExample.java @@ -14,21 +14,21 @@ import com.signnow.core.ApiClient; import com.signnow.core.exception.SignNowApiException; import com.signnow.core.factory.SdkFactory; +import java.io.File; public class FieldInviteExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String senderEmail = "sender@signnow.com"; - String signerEmail = "signer@signnow.com"; - String signerRole = "General Manager"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String senderEmail = data.getSenderEmail(); + String signerEmail = data.getFieldInviteSignerEmail(); + String signerRole = data.getFieldInviteSignerRole(); + String pathToDocument = data.getPathToDocument(); + // Set your actual input data here, or use these as examples String subject = "You have got an invitation to sign the contact"; String message = "Hello, please read and sign the contract"; - String pathToDocument = "/your/path/to/file.pdf"; // Path to a document to be signed try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/FolderExample.java b/examples/FolderExample.java index 39baa85..f4b4972 100644 --- a/examples/FolderExample.java +++ b/examples/FolderExample.java @@ -6,13 +6,11 @@ public class FolderExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String folderId = "14f2b0157ce3cb455a2d8031ccc1fc08bd32f8b5"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String folderId = data.getFolderFolderId(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/FolderRootExample.java b/examples/FolderRootExample.java index 09a610a..233c63e 100644 --- a/examples/FolderRootExample.java +++ b/examples/FolderRootExample.java @@ -6,12 +6,10 @@ public class FolderRootExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/FreeFormInviteExample.java b/examples/FreeFormInviteExample.java index 9e6514c..abe5b01 100644 --- a/examples/FreeFormInviteExample.java +++ b/examples/FreeFormInviteExample.java @@ -6,15 +6,13 @@ public class FreeFormInviteExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String senderEmail = "sender@signnow.com"; - String signerEmail = "signer@signnow.com"; - String documentId = "b2072009b7e0427dba1f6de56df4812da5d8eb9c"; // Document to be signed + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String senderEmail = data.getSenderEmail(); + String signerEmail = data.getFreeFormInviteSignerEmail(); + String documentId = data.getFreeFormInviteDocumentId(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..499b8a9 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,53 @@ +# signNow Java SDK Examples + +## Setup + +1. See the configuration template example for reference: + +```bash +vim examples/signnow-example.properties.example +``` + +Start from an empty template: + +```bash +cp examples/signnow-example.properties.empty examples/signnow-example.properties +``` + +2. Edit `examples/signnow-example.properties` with your signNow API credentials and actual resource IDs. + +> `signnow-example.properties` is git-ignored and will not be committed. + +## Running examples + +Run a single example: + +```bash +make example E=DocumentGetExample +``` + +Run all examples: + +```bash +make examples +``` + +Or call the script directly: + +```bash +examples/bin/run DocumentGetExample +examples/bin/run all +``` + +## Configuration + +Properties follow the naming convention `{domainName}_{variableName}`: +Global properties are an exception and omit {domainName}. + +| Property | Description | +|---|---| +| `bearer_token` | Your signNow API bearer token | +| `path_to_document` | Path to a PDF file for upload examples | +| `document_id` | Existing document ID | +| `bulk_invite_template_id` | Template ID for bulk invite | +| ... | See `signnow-example.properties.example` for the full list | diff --git a/examples/SignNowExampleData.java b/examples/SignNowExampleData.java new file mode 100644 index 0000000..609edf1 --- /dev/null +++ b/examples/SignNowExampleData.java @@ -0,0 +1,182 @@ +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +public class SignNowExampleData { + + private final Properties properties; + + public SignNowExampleData() { + this.properties = new Properties(); + try (FileInputStream fis = new FileInputStream("examples/signnow-example.properties")) { + this.properties.load(fis); + } catch (IOException e) { + throw new RuntimeException( + "Failed to load examples/signnow-example.properties. " + + "Copy signnow-example.properties.example to signnow-example.properties and fill in your values.", + e); + } + } + + public String getBearerToken() { + return this.properties.getProperty("bearer_token", ""); + } + + public String getPathToDocument() { + return this.properties.getProperty("path_to_document", ""); + } + + public String getFirstRecipientRole() { + return this.properties.getProperty("first_recipient_role", ""); + } + + public String getSecondRecipientRole() { + return this.properties.getProperty("second_recipient_role", ""); + } + + public String getSignAction() { + return this.properties.getProperty("sign_action", "sign"); + } + + public String getViewAction() { + return this.properties.getProperty("view_action", "view"); + } + + public String getSenderEmail() { + return this.properties.getProperty("sender_email", ""); + } + + public String getUserId() { + return this.properties.getProperty("user_id", ""); + } + + // BulkInviteExample + public String getBulkInviteTemplateId() { + return this.properties.getProperty("bulk_invite_template_id", ""); + } + + public String getBulkInviteFolderId() { + return this.properties.getProperty("bulk_invite_folder_id", ""); + } + + public String getBulkInviteCsvFilePath() { + return this.properties.getProperty("bulk_invite_csv_file_path", ""); + } + + // DocumentGroupInviteExample + public String getDocumentGroupInviteSignerRole() { + return this.properties.getProperty("document_group_invite_signer_role", ""); + } + + public String getDocumentGroupInviteSignerEmail() { + return this.properties.getProperty("document_group_invite_signer_email", ""); + } + + // DocumentGroupTemplateExample + public String getDocumentGroupTemplateTemplateGroupId() { + return this.properties.getProperty("document_group_template_template_group_id", ""); + } + + public String getDocumentGroupTemplateFolderId() { + return this.properties.getProperty("document_group_template_folder_id", ""); + } + + // DocumentPrefillTextFieldExample + public String getDocumentPrefillTextFieldSignerRole() { + return this.properties.getProperty("document_prefill_text_field_signer_role", ""); + } + + // DocumentGetExample + public String getDocumentId() { + return this.properties.getProperty("document_id", ""); + } + + // DownloadDocumentGroupExample + public String getDownloadDocumentGroupDocumentGroupId() { + return this.properties.getProperty("download_document_group_document_group_id", ""); + } + + public String getDownloadDocumentGroupDocumentId1() { + return this.properties.getProperty("download_document_group_document_id_1", ""); + } + + public String getDownloadDocumentGroupDocumentId2() { + return this.properties.getProperty("download_document_group_document_id_2", ""); + } + + // EmbeddedGroupInviteExample + public String getEmbeddedGroupInviteSigner1Email() { + return this.properties.getProperty("embedded_group_invite_signer_1_email", ""); + } + + public String getEmbeddedGroupInviteSigner2Email() { + return this.properties.getProperty("embedded_group_invite_signer_2_email", ""); + } + + // EmbeddedInviteExample + public String getEmbeddedInviteSignerRole() { + return this.properties.getProperty("embedded_invite_signer_role", ""); + } + + public String getEmbeddedInviteSignerEmail() { + return this.properties.getProperty("embedded_invite_signer_email", ""); + } + + public String getEmbeddedInviteSignerFirstName() { + return this.properties.getProperty("embedded_invite_signer_first_name", ""); + } + + public String getEmbeddedInviteSignerLastName() { + return this.properties.getProperty("embedded_invite_signer_last_name", ""); + } + + // FieldInviteExample + public String getFieldInviteSignerEmail() { + return this.properties.getProperty("field_invite_signer_email", ""); + } + + public String getFieldInviteSignerRole() { + return this.properties.getProperty("field_invite_signer_role", ""); + } + + // FolderExample + public String getFolderFolderId() { + return this.properties.getProperty("folder_folder_id", ""); + } + + // FreeFormInviteExample + public String getFreeFormInviteSignerEmail() { + return this.properties.getProperty("free_form_invite_signer_email", ""); + } + + public String getFreeFormInviteDocumentId() { + return this.properties.getProperty("free_form_invite_document_id", ""); + } + + // WebhookExample + public String getWebhookCallbackUrl() { + return this.properties.getProperty("webhook_callback_url", ""); + } + + // DocumentGroupRecipientsExample + public String getDocumentGroupRecipientsDocumentGroupId() { + return this.properties.getProperty("document_group_recipients_document_group_id", ""); + } + + public String getDocumentGroupRecipientsDocumentId1() { + return this.properties.getProperty("document_group_recipients_document_id_1", ""); + } + + public String getDocumentGroupRecipientsDocumentId2() { + return this.properties.getProperty("document_group_recipients_document_id_2", ""); + } + + // DocumentGroupTemplateRecipientsExample + public String getDocumentGroupTemplateRecipientsTemplateId() { + return this.properties.getProperty("document_group_template_recipients_template_id", ""); + } + + public String getDocumentGroupTemplateRecipientsDocumentId1() { + return this.properties.getProperty("document_group_template_recipients_document_id_1", ""); + } +} diff --git a/examples/SigningLinkExample.java b/examples/SigningLinkExample.java index 00a841a..d911300 100644 --- a/examples/SigningLinkExample.java +++ b/examples/SigningLinkExample.java @@ -1,33 +1,35 @@ import com.signnow.api.document.request.DocumentPostRequest; -import com.signnow.api.document.response.DocumentPostResponse; +import com.signnow.api.document.request.DocumentPutRequest; +import com.signnow.api.document.request.data.FieldCollection; +import com.signnow.api.document.request.data.Field; import com.signnow.api.documentinvite.request.SigningLinkPostRequest; import com.signnow.api.documentinvite.response.SigningLinkPostResponse; +import com.signnow.api.document.response.DocumentPostResponse; import com.signnow.core.ApiClient; import com.signnow.core.exception.SignNowApiException; import com.signnow.core.factory.SdkFactory; +import java.io.File; public class SigningLinkExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example // Preconditions: you have a document available for signing - // it means the document must contain at least one field with assigned signining role + // it means the document must contain at least one field with assigned signing role // Details: https://docs.signnow.com/docs/signnow/signing-link/operations/create-a-link //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - // Provide actual URL to be redirected after successful signing (if you need it) + // Fill in your actual data in examples/signnow-example.properties before running + //---------------------------------------------------- + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String pathToDocument = data.getPathToDocument(); + String signerRole = data.getFirstRecipientRole(); String redirectUrl = null; - // Document to be signed - String pathToDocument = "/your/path/to/file.pdf"; // Path to a document to be signed try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); - DocumentPostRequest request = new DocumentPostRequest(new File(pathToDocument)); - DocumentPostResponse response = (DocumentPostResponse) client.send(request).getResponse(); - String documentId = response.getId(); + DocumentPostRequest requestUpload = new DocumentPostRequest(new File(pathToDocument)); + DocumentPostResponse responseUpload = (DocumentPostResponse) client.send(requestUpload).getResponse(); + String documentId = responseUpload.getId(); // Add fields with roles to the document FieldCollection fields = new FieldCollection(); diff --git a/examples/TemplateExample.java b/examples/TemplateExample.java index 08aab16..2218c23 100644 --- a/examples/TemplateExample.java +++ b/examples/TemplateExample.java @@ -11,13 +11,11 @@ public class TemplateExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - String pathToDocument = "/your/path/to/file.pdf"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String pathToDocument = data.getPathToDocument(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/UserInfoExample.java b/examples/UserInfoExample.java index 06777f7..d0c112b 100644 --- a/examples/UserInfoExample.java +++ b/examples/UserInfoExample.java @@ -6,12 +6,10 @@ public class UserInfoExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); diff --git a/examples/WebhookExample.java b/examples/WebhookExample.java index 9bff1ef..2b6b608 100644 --- a/examples/WebhookExample.java +++ b/examples/WebhookExample.java @@ -8,20 +8,17 @@ import com.signnow.core.ApiClient; import com.signnow.core.exception.SignNowApiException; import com.signnow.core.factory.SdkFactory; +import com.signnow.core.response.Reply; import java.util.Optional; public class WebhookExample { public static void main(String[] args) { - - // Set your actual input data here - // Note: following values are dummy, just for example + // Fill in your actual data in examples/signnow-example.properties before running //---------------------------------------------------- - // if it is not specified here, a new Bearer token will be created automatically - String bearerToken = ""; - // Your user ID - String userId = "f2e913db4ba9815a31f8a28a196b7df96fe1cc46"; - // Your URL to catch webhooks for subscribed events in SignNow - String callbackUrl = "https://demo.requestcatcher.com/"; + SignNowExampleData data = new SignNowExampleData(); + String bearerToken = data.getBearerToken(); + String userId = data.getUserId(); + String callbackUrl = data.getWebhookCallbackUrl(); try { ApiClient client = SdkFactory.createApiClientWithBearerToken(bearerToken); @@ -35,31 +32,22 @@ public static void main(String[] args) { "callback", // we will send callbacks new Attribute(callbackUrl), // to the specified URL null); - client.send(subscriptionRequest); - System.out.println("Subscription is created"); + Reply postReply = client.send(subscriptionRequest); + String subscriptionId = postReply.getHeader("id"); + System.out.println("Subscription is created, ID: " + subscriptionId); + System.out.println(new String(new char[10]).replace("\0", "-")); // 2. Get all subscriptions SubscriptionGetRequest subscriptionsRequest = new SubscriptionGetRequest(); SubscriptionGetResponse subscriptionsResponse = (SubscriptionGetResponse) client.send(subscriptionsRequest).getResponse(); - String subscriptionId = null; DataSubscriptionCollection subscriptions = subscriptionsResponse.getData(); for (DataSubscription subscription : subscriptions) { System.out.println("ID: " + subscription.getId()); System.out.println("Event: " + subscription.getEvent()); System.out.println("Entity ID: " + subscription.getEntityId()); System.out.println("Action: " + subscription.getAction()); - System.out.println( - "Headers: " - + Optional.ofNullable(subscription.getJsonAttributes().getHeaders()) - .map(m -> m.toString()) - .orElse("{}")); - System.out.println(new String(new char[10]).replace("\0", "-")); - - if ("user.document.open".equals(subscription.getEvent())) { - subscriptionId = subscription.getId(); - } } // 3. Delete the subscription @@ -67,7 +55,7 @@ public static void main(String[] args) { SubscriptionDeleteRequest deleteRequest = new SubscriptionDeleteRequest(); deleteRequest.withEventSubscriptionId(subscriptionId); client.send(deleteRequest); - System.out.println("Subscription is deleted"); + System.out.println("Subscription is deleted, ID: " + subscriptionId); } } catch (SignNowApiException e) { System.out.println("ERROR: " + e.getMessage()); diff --git a/examples/bin/run b/examples/bin/run new file mode 100755 index 0000000..88ebfbb --- /dev/null +++ b/examples/bin/run @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +EXAMPLES_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +PROJECT_DIR="$(cd "$EXAMPLES_DIR/.." && pwd)" + +# Resolve SDK JAR path +SDK_JAR="$PROJECT_DIR/$(mvn -f "$PROJECT_DIR/pom.xml" help:evaluate -Dexpression=project.build.directory -q -DforceStdout | sed "s|$PROJECT_DIR/||")/$(mvn -f "$PROJECT_DIR/pom.xml" help:evaluate -Dexpression=project.build.finalName -q -DforceStdout).jar" + +# Build SDK JAR +mvn -f "$PROJECT_DIR/pom.xml" package -DskipTests -q + +# Resolve dependency classpath +SDK_CP=$(mvn -f "$PROJECT_DIR/pom.xml" dependency:build-classpath -q -DincludeScope=runtime -Dmdep.outputFile=/dev/stdout 2>/dev/null) + +run_example() { + local name="$1" + if [ ! -f "$EXAMPLES_DIR/$name.java" ]; then + echo "ERROR: $EXAMPLES_DIR/$name.java not found" + return 1 + fi + echo "--- Running $name ---" + local start=$SECONDS + local output + javac -cp "$SDK_JAR:$SDK_CP" "$EXAMPLES_DIR/SignNowExampleData.java" "$EXAMPLES_DIR/$name.java" + output=$(java -cp "$SDK_JAR:$SDK_CP:$EXAMPLES_DIR/" "$name" 2>&1) || true + rm -f "$EXAMPLES_DIR"/*.class + echo "$output" + echo "--- $name completed in $((SECONDS - start))s ---" + if echo "$output" | grep -qiE "error"; then + return 1 + fi +} + +if [ $# -eq 0 ]; then + echo "Usage: examples/bin/run " + echo " examples/bin/run DocumentGetExample" + echo " examples/bin/run all" + exit 1 +fi + +if [ "$1" = "all" ]; then + total_start=$SECONDS + succeeded=0 + failed=0 + failed_list=() + for file in "$EXAMPLES_DIR"/*Example.java; do + name=$(basename "$file" .java) + if run_example "$name"; then + echo "" + succeeded=$((succeeded + 1)) + else + echo "FAILED: $name" + echo "" + failed=$((failed + 1)) + failed_list+=("$name") + fi + done + total_time=$((SECONDS - total_start)) + echo "" + echo "=== Completed in ${total_time}s ===" + echo "Succeeded examples: $succeeded" + echo "Failed examples: $failed" + if [ $failed -gt 0 ]; then + for name in "${failed_list[@]}"; do + echo " - $name" + done + exit 1 + fi +else + run_example "$1" +fi diff --git a/examples/files/bulk_demo.csv b/examples/files/bulk_demo.csv new file mode 100644 index 0000000..83391f2 --- /dev/null +++ b/examples/files/bulk_demo.csv @@ -0,0 +1 @@ +Signer 1|user@signnow.com,Contract_0_Jack diff --git a/examples/files/demo.pdf b/examples/files/demo.pdf new file mode 100644 index 0000000000000000000000000000000000000000..757bb1f36404ff475efeb6fda3350468de425004 GIT binary patch literal 4911 zcmeHLe{2)i9XCJ9kXvt2mjY9@?&LNdEIr@5cX$4AvrUq7+=Rr$*iixkCeC;7k}GGQ zxjQFLTE;>IZRpl^i&V8+D^*duij``EwSTSch#*r}3D`unF|A58CN>q(GNE*6bcnsP zoj7)l#iah3lP$gbzW4pS&-e4*_u1dq6putn+T(RKUHtpG^DZZ32|(zn$6Uc66;(A0 z8B|mgEfhhLE+cF*Op9QtZj>3Y1_?-esjUP}^^Rl_)suQGX{Ezq(=w2lb~y)UgU@d3 zIt3aJ-TGkv&ZjTTzWNaVjd8WH@id%y_exV&hI_&LlZSt{d9H8f&*s#G;2)-i2PT=-pI`j<)7@J??fBP+Ig{Oe_4CistH+5q6RP)Tf!xKmP-#PZJ z@taSAiS^w;e(BfDJO4fO7JWe*oO)rySNSnx@|V{eTl@Swu70%Vl={-!-`jPqch}>g zCtBY4wB@eJf4+EW^d@=I@x(9U$6QX7kxN11mMs?K{vXxYKt0h;#6kR5$NxBdmO9hC z4Sab0Z1<*TyzENnnwiT__O5&N@>d@E`RnWc`j-`}H#p{Q-2G-PHr_j66IfV77GgH= zc1sA8AP)M$TQ;TZ&1cAG*6edN9!!05bHP*I!!iztkVO-!Y;bjynJGeDwH@_l|CQabm;Nii!4? zm!0eO>~B3f^Pkt+e}8nQg;{mv+T?h$YwELAyFQv163tt1AoJtby6){t+;`8s@SVF8 zW25JjpImXQyvK3jm2W>^E2?r(r6gcD$Wh5$%CeJSd#t-CWei!OELvhYAA+0nSy9@H zEFy&l)J({I^*6tD6RI3?_j552%L-^v?HDysa&&92G`d#`$nMQyXE4v_)7dmeBl2l2 zWAgcsTg00V@wjc9DK}9VV(ksNTkQ^Fdn`@}x`7DJ!;%sJ9O3hOXx7I-?;`{RG^Bu^ zf(%JBJg`4R>2ZghxD_;Hg-=AHrRnfn$USITS)QVXhlf4Gj7K*HC^`@bPykX8l6VAZ zj$|w`PiD*qiy#X)5oAh+nzd9tL)f@tO3zs#x7(g*@hQfYT{2O|^b}(BNP3#W9Te?h zs9H`~nniXMPI)nloxts!VzK&e>2ys`Sz2_<<_xW%ge*}=Lur(;Ogtk^Eee3+3u5kk z+|cEmgp6>jWauf;A|k43shWli!s`LV#(otaBE#mUpdD#>bXlSxj*=Jfp^A@T{0&0@ zyd+>q;O(V39(Z{Mw{Zgmsj88+Fm$6=*R^nAtHhI>N7gi=4;iMtM4ShD;1ZP5*eaNq zF00B&i3*LW_(+=Tr2$Vv9@5Rgzer`t$ZCvIdfXAp(y^5|u^1oGrJSvPXC$1H7uT&Wve^83`@mGF*V+K#Czng#{!l z`$aM!dnLROwBMUz6(z-Z7jT#OF2R*0UeS%TXobaWR#PR>P78a{gH*Yza=fKl8Y-ma zVzw0WvsJSyt@dWK6HHU>yyZ19GZ1p;Nf{|(PP5$MHf-5T;2(QpL9ZZH9AAl3v{u3w z=v6ZbV#<=eCv~F=!G=wueU;WSzia}jL;QgOAaT4gouspc_ig5bqEnXieg)E zXJ&fLTS8TY> z54neNJyxS4r0H@=xKQ;G5Ze+|TpU2%VhU*{Vb|nEgGu-c?ZTyrfJ;P89|(tC3s(tD z8Lh?zOsVFiLAkE%m{_?MIPkNg203WYRl3h9-r>YWBW>c_9YNP}>5PdlbK(Y)RSEx* zBWM^7*ShxUjO+|X+I&7ACkX8j`l8-81_&$*B2gAXIwCLu5DvCQ1wn{1Q4aUh4BOfk zVFbXo2HIJnl?LAS@NTLzqv%AS5Pm5VKcEu2ZV?3)6I4q)`1kX{;u_ zyBzS~Y%1kg`7oG%Uwi-L{H?1a8}W?}-7&V~hb toMap() { + Map map = new LinkedHashMap<>(); + map.put("remind_after", this.getRemindAfter()); + map.put("remind_before", this.getRemindBefore()); + map.put("remind_repeat", this.getRemindRepeat()); + return map; + } + + @NotNull + @Contract("_ -> new") + public static GeneralReminder fromMap(@NotNull Map data) { + return new GeneralReminder( + (int) data.getOrDefault("remind_after", 0), + (int) data.getOrDefault("remind_before", 0), + (int) data.getOrDefault("remind_repeat", 0)); + } +} diff --git a/src/main/java/com/signnow/api/documentgroup/request/DocumentGroupRecipientsPutRequest.java b/src/main/java/com/signnow/api/documentgroup/request/DocumentGroupRecipientsPutRequest.java index f0efb75..8705724 100644 --- a/src/main/java/com/signnow/api/documentgroup/request/DocumentGroupRecipientsPutRequest.java +++ b/src/main/java/com/signnow/api/documentgroup/request/DocumentGroupRecipientsPutRequest.java @@ -11,8 +11,10 @@ import com.signnow.core.request.ApiEndpoint; import com.signnow.core.request.RequestInterface; -import com.signnow.api.documentgroup.request.data.recipient.RecipientCollection; import com.signnow.api.documentgroup.request.data.CcCollection; +import com.signnow.api.documentgroup.request.data.GeneralReminder; +import com.signnow.api.documentgroup.request.data.recipient.RecipientCollection; + import java.util.HashMap; import java.util.Map; @@ -21,19 +23,25 @@ * It implements the RequestInterface with Object type. */ @ApiEndpoint( - name = "updateDocumentGroupRecipients", - url = "/v2/document-groups/{document_group_id}/recipients", - method = "put", - auth = "bearer", - namespace = "documentGroup", - entity = "documentGroupRecipients", - type = "application/json") + name = "updateDocumentGroupRecipients", + url = "/v2/document-groups/{document_group_id}/recipients", + method = "put", + auth = "bearer", + namespace = "documentGroup", + entity = "documentGroupRecipients", + type = "application/json") public final class DocumentGroupRecipientsPutRequest implements RequestInterface { private final RecipientCollection recipients; private final CcCollection cc; + private final Integer generalExpirationDays; + + private final GeneralReminder generalReminder; + + private final String orderType; + private final HashMap uriParams = new HashMap<>(); /** @@ -43,8 +51,30 @@ public final class DocumentGroupRecipientsPutRequest implements RequestInterface * @param cc the collection of cc */ public DocumentGroupRecipientsPutRequest(RecipientCollection recipients, CcCollection cc) { - this.recipients = recipients; - this.cc = cc; + this(recipients, cc, null, null, null); + } + + /** + * Constructs a new DocumentGroupRecipientsPutRequest with all fields. + * + * @param recipients the collection of recipients + * @param cc the collection of cc + * @param generalExpirationDays the number of general expiration days + * @param generalReminder the general reminder + * @param orderType the order type (at_the_same_time, recipient_order, advanced_order) + */ + public DocumentGroupRecipientsPutRequest( + RecipientCollection recipients, + CcCollection cc, + Integer generalExpirationDays, + GeneralReminder generalReminder, + String orderType) { + // Ensure collections are never null to avoid NPE in payload() + this.recipients = recipients != null ? recipients : new RecipientCollection(); + this.cc = cc != null ? cc : new CcCollection(); + this.generalExpirationDays = generalExpirationDays; + this.generalReminder = generalReminder; + this.orderType = orderType; } /** @@ -65,6 +95,33 @@ public CcCollection getCc() { return this.cc; } + /** + * Returns the number of general expiration days. + * + * @return the number of general expiration days, or null if not set + */ + public Integer getGeneralExpirationDays() { + return this.generalExpirationDays; + } + + /** + * Returns the general reminder. + * + * @return the general reminder, or null if not set + */ + public GeneralReminder getGeneralReminder() { + return this.generalReminder; + } + + /** + * Returns the order type. + * + * @return the order type, or null if not set + */ + public String getOrderType() { + return this.orderType; + } + /** * Sets the document group ID in the URI parameters. * @@ -72,7 +129,10 @@ public CcCollection getCc() { * @return the current instance of DocumentGroupRecipientsPutRequest */ public DocumentGroupRecipientsPutRequest withDocumentGroupId(String documentGroupId) { - this.uriParams.put("document_group_id", documentGroupId); + // Safe put to URI params, ignore null IDs + if (documentGroupId != null) { + this.uriParams.put("document_group_id", documentGroupId); + } return this; } @@ -94,8 +154,18 @@ public HashMap uriParams() { @Override public Map payload() { Map map = new HashMap<>(); - map.put("recipients", this.getRecipients().toArray()); - map.put("cc", this.getCc().toArray()); + // Defensive null checks to prevent NPE during serialization + map.put("recipients", this.recipients != null ? this.recipients.toArray() : new Object[0]); + map.put("cc", this.cc != null ? this.cc.toArray() : new Object[0]); + if (this.generalExpirationDays != null) { + map.put("general_expiration_days", this.generalExpirationDays); + } + if (this.generalReminder != null) { + map.put("general_reminder", this.generalReminder.toMap()); + } + if (this.orderType != null) { + map.put("order_type", this.orderType); + } return map; } } diff --git a/src/main/java/com/signnow/api/documentgroup/request/data/GeneralReminder.java b/src/main/java/com/signnow/api/documentgroup/request/data/GeneralReminder.java new file mode 100644 index 0000000..ffbd919 --- /dev/null +++ b/src/main/java/com/signnow/api/documentgroup/request/data/GeneralReminder.java @@ -0,0 +1,109 @@ +/* + * This file is a part of signNow SDK API client. + * + * (с) Copyright © 2011-present airSlate Inc. (https://www.signnow.com) + * + * For more details on copyright, see LICENSE.md file + * that was distributed with this source code. + */ + +package com.signnow.api.documentgroup.request.data; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.signnow.core.data.ApiData; +import java.util.LinkedHashMap; +import java.util.Map; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; + +/** + * Represents a general reminder with specific time intervals for the document group request. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public final class GeneralReminder extends ApiData { + + @JsonProperty("remind_after") + private final int remindAfter; + + @JsonProperty("remind_before") + private final int remindBefore; + + @JsonProperty("remind_repeat") + private final int remindRepeat; + + /** + * Constructs a new GeneralReminder instance. + * + * @param remindAfter the time after which to remind + * @param remindBefore the time before which to remind + * @param remindRepeat the repeat interval for reminders + */ + @JsonCreator + public GeneralReminder( + @JsonProperty("remind_after") int remindAfter, + @JsonProperty("remind_before") int remindBefore, + @JsonProperty("remind_repeat") int remindRepeat) { + this.remindAfter = remindAfter; + this.remindBefore = remindBefore; + this.remindRepeat = remindRepeat; + } + + /** + * Gets the time after which to remind. + * + * @return the remind after time + */ + public int getRemindAfter() { + return this.remindAfter; + } + + /** + * Gets the time before which to remind. + * + * @return the remind before time + */ + public int getRemindBefore() { + return this.remindBefore; + } + + /** + * Gets the repeat interval for reminders. + * + * @return the remind repeat interval + */ + public int getRemindRepeat() { + return this.remindRepeat; + } + + /** + * Converts the general reminder data to a map. + * + * @return a map representation of the general reminder data + */ + @NotNull + @Override + public Map toMap() { + Map map = new LinkedHashMap<>(); + map.put("remind_after", this.getRemindAfter()); + map.put("remind_before", this.getRemindBefore()); + map.put("remind_repeat", this.getRemindRepeat()); + return map; + } + + /** + * Creates a GeneralReminder instance from a map. + * + * @param data the map containing general reminder data + * @return a new GeneralReminder instance + */ + @NotNull + @Contract("_ -> new") + public static GeneralReminder fromMap(@NotNull Map data) { + return new GeneralReminder( + (int) data.getOrDefault("remind_after", 0), + (int) data.getOrDefault("remind_before", 0), + (int) data.getOrDefault("remind_repeat", 0)); + } +} diff --git a/src/main/java/com/signnow/api/documentgroup/request/data/recipient/Attribute.java b/src/main/java/com/signnow/api/documentgroup/request/data/recipient/Attribute.java index b09bb4a..f2d8bb8 100644 --- a/src/main/java/com/signnow/api/documentgroup/request/data/recipient/Attribute.java +++ b/src/main/java/com/signnow/api/documentgroup/request/data/recipient/Attribute.java @@ -10,7 +10,9 @@ package com.signnow.api.documentgroup.request.data.recipient; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.signnow.core.data.ApiData; import org.jetbrains.annotations.Contract; @@ -23,16 +25,17 @@ * Represents the attributes of a recipient in a document group request. */ @JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) public final class Attribute extends ApiData { @JsonProperty("allow_forwarding") - private final boolean allowForwarding; + private final Boolean allowForwarding; @JsonProperty("show_decline_button") - private final boolean showDeclineButton; + private final Boolean showDeclineButton; @JsonProperty("i_am_recipient") - private final boolean iAmRecipient; + private final Boolean iAmRecipient; @JsonProperty("message") private final String message; @@ -49,8 +52,55 @@ public final class Attribute extends ApiData { @JsonProperty("authentication") private final Authentication authentication; + @JsonProperty("cfr") + private final Boolean cfr; + + @JsonProperty("contact_id") + private final String contactId; + + @JsonProperty("phone_invite_country_code") + private final String phoneInviteCountryCode; + + @JsonProperty("sms_message") + private final String smsMessage; + + /** + * Constructs signer attributes (full set of properties). + * + * @param allowForwarding whether forwarding is allowed + * @param showDeclineButton whether the decline button is shown + * @param iAmRecipient whether the recipient is the current user + * @param message the message for the recipient + * @param subject the subject for the recipient + * @param expirationDays the expiration days for the recipient + * @param reminder the reminder for the recipient + * @param authentication the authentication for the recipient + */ + public Attribute( + boolean allowForwarding, + boolean showDeclineButton, + boolean iAmRecipient, + String message, + String subject, + Integer expirationDays, + Reminder reminder, + Authentication authentication) { + this.allowForwarding = allowForwarding; + this.showDeclineButton = showDeclineButton; + this.iAmRecipient = iAmRecipient; + this.message = message; + this.subject = subject; + this.expirationDays = expirationDays; + this.reminder = reminder; + this.authentication = authentication; + this.cfr = null; + this.contactId = null; + this.phoneInviteCountryCode = null; + this.smsMessage = null; + } + /** - * Constructs an instance of Attribute. + * Creates signer attributes (full set of properties). * * @param allowForwarding whether forwarding is allowed * @param showDeclineButton whether the decline button is shown @@ -60,17 +110,65 @@ public final class Attribute extends ApiData { * @param expirationDays the expiration days for the recipient * @param reminder the reminder for the recipient * @param authentication the authentication for the recipient + * @return signer Attribute instance + */ + public static Attribute signer( + boolean allowForwarding, + boolean showDeclineButton, + boolean iAmRecipient, + String message, + String subject, + Integer expirationDays, + Reminder reminder, + Authentication authentication) { + return new Attribute(allowForwarding, showDeclineButton, iAmRecipient, + message, subject, expirationDays, reminder, authentication); + } + + /** + * Creates viewer attributes (restricted set of properties). + * Only allowed fields: message, subject, iAmRecipient, cfr, contactId, + * phoneInviteCountryCode, smsMessage. + * + * @param message the message for the viewer + * @param subject the subject for the viewer + * @param iAmRecipient whether the viewer is the current user + * @param cfr whether CFR is enabled + * @param contactId the contact ID + * @param phoneInviteCountryCode the phone invite country code + * @param smsMessage the SMS message + * @return viewer Attribute instance + */ + public static Attribute viewer( + String message, + String subject, + boolean iAmRecipient, + Boolean cfr, + String contactId, + String phoneInviteCountryCode, + String smsMessage) { + return new Attribute( + null, null, iAmRecipient, message, subject, null, null, null, + cfr, contactId, phoneInviteCountryCode, smsMessage); + } + + /** + * Full constructor used for JSON deserialization. */ @JsonCreator public Attribute( - @JsonProperty("allow_forwarding") boolean allowForwarding, - @JsonProperty("show_decline_button") boolean showDeclineButton, - @JsonProperty("i_am_recipient") boolean iAmRecipient, + @JsonProperty("allow_forwarding") Boolean allowForwarding, + @JsonProperty("show_decline_button") Boolean showDeclineButton, + @JsonProperty("i_am_recipient") Boolean iAmRecipient, @JsonProperty("message") String message, @JsonProperty("subject") String subject, @JsonProperty("expiration_days") Integer expirationDays, @JsonProperty("reminder") Reminder reminder, - @JsonProperty("authentication") Authentication authentication) { + @JsonProperty("authentication") Authentication authentication, + @JsonProperty("cfr") Boolean cfr, + @JsonProperty("contact_id") String contactId, + @JsonProperty("phone_invite_country_code") String phoneInviteCountryCode, + @JsonProperty("sms_message") String smsMessage) { this.allowForwarding = allowForwarding; this.showDeclineButton = showDeclineButton; this.iAmRecipient = iAmRecipient; @@ -79,97 +177,84 @@ public Attribute( this.expirationDays = expirationDays; this.reminder = reminder; this.authentication = authentication; + this.cfr = cfr; + this.contactId = contactId; + this.phoneInviteCountryCode = phoneInviteCountryCode; + this.smsMessage = smsMessage; } - /** - * Gets the message for the recipient. - * - * @return the message - */ public String getMessage() { return this.message; } - /** - * Gets the subject for the recipient. - * - * @return the subject - */ public String getSubject() { return this.subject; } - /** - * Gets the expiration days for the recipient. - * - * @return the expiration days - */ public Integer getExpirationDays() { return this.expirationDays; } - /** - * Gets the reminder for the recipient. - * - * @return the reminder - */ public Reminder getReminder() { return this.reminder; } - /** - * Checks if forwarding is allowed. - * - * @return true if forwarding is allowed, false otherwise - */ + @JsonIgnore public boolean isAllowForwarding() { - return this.allowForwarding; + return this.allowForwarding != null && this.allowForwarding; } - /** - * Checks if the decline button is shown. - * - * @return true if the decline button is shown, false otherwise - */ + @JsonIgnore public boolean isShowDeclineButton() { - return this.showDeclineButton; + return this.showDeclineButton != null && this.showDeclineButton; } - /** - * Checks if the recipient is the current user. - * - * @return true if the recipient is the current user, false otherwise - */ + @JsonIgnore public boolean isIAmRecipient() { - return this.iAmRecipient; + return this.iAmRecipient != null && this.iAmRecipient; } - /** - * Gets the authentication for the recipient. - * - * @return the authentication - */ public Authentication getAuthentication() { return this.authentication; } + public Boolean getCfr() { + return this.cfr; + } + + public String getContactId() { + return this.contactId; + } + + public String getPhoneInviteCountryCode() { + return this.phoneInviteCountryCode; + } + + public String getSmsMessage() { + return this.smsMessage; + } + /** - * Converts the attributes to a map. + * Converts the attributes to a map, omitting null values. * - * @return a map representation of the attributes + * @return a map representation of the attributes with only non-null values */ @NotNull @Override public Map toMap() { Map map = new LinkedHashMap<>(); - map.put("message", this.getMessage()); - map.put("subject", this.getSubject()); - map.put("expiration_days", this.getExpirationDays()); - map.put("reminder", this.getReminder()); - map.put("allow_forwarding", this.isAllowForwarding()); - map.put("show_decline_button", this.isShowDeclineButton()); - map.put("i_am_recipient", this.isIAmRecipient()); - map.put("authentication", this.getAuthentication()); + if (this.message != null) map.put("message", this.message); + if (this.subject != null) map.put("subject", this.subject); + if (this.iAmRecipient != null) map.put("i_am_recipient", this.iAmRecipient); + if (this.allowForwarding != null) map.put("allow_forwarding", this.allowForwarding); + if (this.showDeclineButton != null) map.put("show_decline_button", this.showDeclineButton); + if (this.expirationDays != null) map.put("expiration_days", this.expirationDays); + if (this.reminder != null) map.put("reminder", this.reminder); + if (this.authentication != null) map.put("authentication", this.authentication); + if (this.cfr != null) map.put("cfr", this.cfr); + if (this.contactId != null) map.put("contact_id", this.contactId); + if (this.phoneInviteCountryCode != null) map.put("phone_invite_country_code", this.phoneInviteCountryCode); + if (this.smsMessage != null) map.put("sms_message", this.smsMessage); return map; } @@ -183,14 +268,18 @@ public Map toMap() { @Contract("_ -> new") public static Attribute fromMap(@NotNull Map data) { return new Attribute( - (boolean) data.getOrDefault("allow_forwarding", false), - (boolean) data.getOrDefault("show_decline_button", false), - (boolean) data.getOrDefault("i_am_recipient", false), - (String) data.getOrDefault("message", ""), - (String) data.getOrDefault("subject", ""), + (Boolean) data.getOrDefault("allow_forwarding", null), + (Boolean) data.getOrDefault("show_decline_button", null), + (Boolean) data.getOrDefault("i_am_recipient", null), + (String) data.getOrDefault("message", null), + (String) data.getOrDefault("subject", null), (Integer) data.get("expiration_days"), (Reminder) data.get("reminder"), - (Authentication) data.get("authentication") + (Authentication) data.get("authentication"), + (Boolean) data.get("cfr"), + (String) data.get("contact_id"), + (String) data.get("phone_invite_country_code"), + (String) data.get("sms_message") ); } } diff --git a/src/main/java/com/signnow/api/documentgroup/response/DocumentGroupGetResponse.java b/src/main/java/com/signnow/api/documentgroup/response/DocumentGroupGetResponse.java index 5c33d2b..747af2d 100644 --- a/src/main/java/com/signnow/api/documentgroup/response/DocumentGroupGetResponse.java +++ b/src/main/java/com/signnow/api/documentgroup/response/DocumentGroupGetResponse.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.signnow.api.documentgroup.response.data.OriginatorOrganizationSettingsCollection; +import com.signnow.api.documentgroup.response.data.data.GeneralReminder; import com.signnow.api.documentgroup.response.data.document.DocumentItemCollection; /** @@ -50,6 +51,25 @@ public class DocumentGroupGetResponse { @JsonProperty("invite_id") private final String inviteId; + /** + * The number of general expiration days for the document group. + */ + @JsonProperty("general_expiration_days") + private final Integer generalExpirationDays; + + /** + * General reminder for the document group. + */ + @JsonProperty("general_reminder") + private final GeneralReminder generalReminder; + + /** + * The order type for the document group recipients. + * Possible values: at_the_same_time, recipient_order, advanced_order. + */ + @JsonProperty("order_type") + private final String orderType; + /** * Constructs a new DocumentGroupGetResponse with the specified parameters. * @@ -58,6 +78,9 @@ public class DocumentGroupGetResponse { * @param documents the collection of documents in the document group * @param originatorOrganizationSettings the settings of the organization that originated the document group * @param inviteId the unique identifier of the invite + * @param generalExpirationDays the number of general expiration days + * @param generalReminder the general reminder + * @param orderType the order type for the document group recipients */ public DocumentGroupGetResponse( @JsonProperty("id") String id, @@ -65,12 +88,18 @@ public DocumentGroupGetResponse( @JsonProperty("documents") DocumentItemCollection documents, @JsonProperty("originator_organization_settings") OriginatorOrganizationSettingsCollection originatorOrganizationSettings, - @JsonProperty("invite_id") String inviteId) { + @JsonProperty("invite_id") String inviteId, + @JsonProperty("general_expiration_days") Integer generalExpirationDays, + @JsonProperty("general_reminder") GeneralReminder generalReminder, + @JsonProperty("order_type") String orderType) { this.id = id; this.groupName = groupName; this.documents = documents; this.originatorOrganizationSettings = originatorOrganizationSettings; this.inviteId = inviteId; + this.generalExpirationDays = generalExpirationDays; + this.generalReminder = generalReminder; + this.orderType = orderType; } /** @@ -117,4 +146,31 @@ public OriginatorOrganizationSettingsCollection getOriginatorOrganizationSetting public String getInviteId() { return this.inviteId; } + + /** + * Returns the number of general expiration days. + * + * @return the number of general expiration days, or null if not set + */ + public Integer getGeneralExpirationDays() { + return this.generalExpirationDays; + } + + /** + * Returns the collection of general reminders. + * + * @return the general reminder, or null if not set + */ + public GeneralReminder getGeneralReminder() { + return this.generalReminder; + } + + /** + * Returns the order type for the document group recipients. + * + * @return the order type, or null if not set + */ + public String getOrderType() { + return this.orderType; + } } \ No newline at end of file diff --git a/src/main/java/com/signnow/api/documentgroup/response/data/data/Data.java b/src/main/java/com/signnow/api/documentgroup/response/data/data/Data.java index 4fcbfb6..4b0e4b5 100644 --- a/src/main/java/com/signnow/api/documentgroup/response/data/data/Data.java +++ b/src/main/java/com/signnow/api/documentgroup/response/data/data/Data.java @@ -47,6 +47,25 @@ public final class Data extends ApiData { @JsonProperty("cc") private final CcCollection cc; + /** + * The number of general expiration days for the document group. + */ + @JsonProperty("general_expiration_days") + private final Integer generalExpirationDays; + + /** + * General reminder for the document group. + */ + @JsonProperty("general_reminder") + private final GeneralReminder generalReminder; + + /** + * The order type for the document group recipients. + * Possible values: at_the_same_time, recipient_order, advanced_order. + */ + @JsonProperty("order_type") + private final String orderType; + /** * Constructor for Data class. * @@ -54,6 +73,9 @@ public final class Data extends ApiData { * @param unmappedDocuments Collection of unmapped documents. * @param allowedUnmappedSignDocuments Collection of allowed unmapped sign documents. * @param cc Collection of cc. + * @param generalExpirationDays The number of general expiration days. + * @param generalReminder General reminder. + * @param orderType The order type for the document group recipients. */ @JsonCreator public Data( @@ -61,11 +83,17 @@ public Data( @JsonProperty("unmapped_documents") UnmappedDocumentCollection unmappedDocuments, @JsonProperty("allowed_unmapped_sign_documents") AllowedUnmappedSignDocumentCollection allowedUnmappedSignDocuments, - @JsonProperty("cc") CcCollection cc) { + @JsonProperty("cc") CcCollection cc, + @JsonProperty("general_expiration_days") Integer generalExpirationDays, + @JsonProperty("general_reminder") GeneralReminder generalReminder, + @JsonProperty("order_type") String orderType) { this.recipients = recipients; this.unmappedDocuments = unmappedDocuments; this.allowedUnmappedSignDocuments = allowedUnmappedSignDocuments; this.cc = cc; + this.generalExpirationDays = generalExpirationDays; + this.generalReminder = generalReminder; + this.orderType = orderType; } /** @@ -104,6 +132,33 @@ public CcCollection getCc() { return this.cc; } + /** + * Getter for general expiration days. + * + * @return The number of general expiration days, or null if not set. + */ + public Integer getGeneralExpirationDays() { + return this.generalExpirationDays; + } + + /** + * Getter for general reminder. + * + * @return GeneralReminder, or null if not set. + */ + public GeneralReminder getGeneralReminder() { + return this.generalReminder; + } + + /** + * Getter for order type. + * + * @return The order type for the document group recipients, or null if not set. + */ + public String getOrderType() { + return this.orderType; + } + /** * Converts the Data object to a Map. * @@ -117,6 +172,9 @@ public Map toMap() { map.put("unmapped_documents", this.getUnmappedDocuments()); map.put("allowed_unmapped_sign_documents", this.getAllowedUnmappedSignDocuments()); map.put("cc", this.getCc()); + map.put("general_expiration_days", this.getGeneralExpirationDays()); + map.put("general_reminder", this.getGeneralReminder()); + map.put("order_type", this.getOrderType()); return map; } @@ -133,6 +191,9 @@ public static Data fromMap(@NotNull Map data) { (RecipientCollection) data.get("recipients"), (UnmappedDocumentCollection) data.get("unmapped_documents"), (AllowedUnmappedSignDocumentCollection) data.get("allowed_unmapped_sign_documents"), - (CcCollection) data.get("cc")); + (CcCollection) data.get("cc"), + (Integer) data.getOrDefault("general_expiration_days", null), + (GeneralReminder) data.getOrDefault("general_reminder", null), + (String) data.getOrDefault("order_type", null)); } } \ No newline at end of file diff --git a/src/main/java/com/signnow/api/documentgroup/response/data/data/GeneralReminder.java b/src/main/java/com/signnow/api/documentgroup/response/data/data/GeneralReminder.java new file mode 100644 index 0000000..c8a57d3 --- /dev/null +++ b/src/main/java/com/signnow/api/documentgroup/response/data/data/GeneralReminder.java @@ -0,0 +1,119 @@ +/* + * This file is a part of signNow SDK API client. + * + * (с) Copyright © 2011-present airSlate Inc. (https://www.signnow.com) + * + * For more details on copyright, see LICENSE.md file + * that was distributed with this source code. + */ + +package com.signnow.api.documentgroup.response.data.data; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.signnow.core.data.ApiData; +import java.util.LinkedHashMap; +import java.util.Map; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; + +/** + * GeneralReminder class extends ApiData. + * It represents the general reminder data in the document group recipients response. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public final class GeneralReminder extends ApiData { + + /** + * The time after which the reminder should be sent. + */ + @JsonProperty("remind_after") + private final int remindAfter; + + /** + * The time before which the reminder should be sent. + */ + @JsonProperty("remind_before") + private final int remindBefore; + + /** + * The frequency of the reminder. + */ + @JsonProperty("remind_repeat") + private final int remindRepeat; + + /** + * Constructor for GeneralReminder class. + * + * @param remindAfter The time after which the reminder should be sent. + * @param remindBefore The time before which the reminder should be sent. + * @param remindRepeat The frequency of the reminder. + */ + @JsonCreator + public GeneralReminder( + @JsonProperty("remind_after") int remindAfter, + @JsonProperty("remind_before") int remindBefore, + @JsonProperty("remind_repeat") int remindRepeat) { + this.remindAfter = remindAfter; + this.remindBefore = remindBefore; + this.remindRepeat = remindRepeat; + } + + /** + * Getter for remindAfter. + * + * @return The time after which the reminder should be sent. + */ + public int getRemindAfter() { + return this.remindAfter; + } + + /** + * Getter for remindBefore. + * + * @return The time before which the reminder should be sent. + */ + public int getRemindBefore() { + return this.remindBefore; + } + + /** + * Getter for remindRepeat. + * + * @return The frequency of the reminder. + */ + public int getRemindRepeat() { + return this.remindRepeat; + } + + /** + * Converts the GeneralReminder object to a Map. + * + * @return A map representation of the GeneralReminder object. + */ + @NotNull + @Override + public Map toMap() { + Map map = new LinkedHashMap<>(); + map.put("remind_after", this.getRemindAfter()); + map.put("remind_before", this.getRemindBefore()); + map.put("remind_repeat", this.getRemindRepeat()); + return map; + } + + /** + * Creates a GeneralReminder object from a Map. + * + * @param data The map containing the general reminder data. + * @return A new GeneralReminder object. + */ + @NotNull + @Contract("_ -> new") + public static GeneralReminder fromMap(@NotNull Map data) { + return new GeneralReminder( + (int) data.getOrDefault("remind_after", 0), + (int) data.getOrDefault("remind_before", 0), + (int) data.getOrDefault("remind_repeat", 0)); + } +} diff --git a/src/main/java/com/signnow/api/documentgrouptemplate/request/DocumentGroupTemplateRecipientsGetRequest.java b/src/main/java/com/signnow/api/documentgrouptemplate/request/DocumentGroupTemplateRecipientsGetRequest.java new file mode 100644 index 0000000..fa1b6b3 --- /dev/null +++ b/src/main/java/com/signnow/api/documentgrouptemplate/request/DocumentGroupTemplateRecipientsGetRequest.java @@ -0,0 +1,69 @@ +/* + * This file is a part of signNow SDK API client. + * + * (с) Copyright © 2011-present airSlate Inc. (https://www.signnow.com) + * + * For more details on copyright, see LICENSE.md file + * that was distributed with this source code. + */ + +package com.signnow.api.documentgrouptemplate.request; + +import com.signnow.core.request.ApiEndpoint; +import com.signnow.core.request.RequestInterface; +import java.util.HashMap; +import java.util.Map; +import org.jetbrains.annotations.NotNull; + +/** + * This class represents a request to get the recipients of a document group template. + * It implements the RequestInterface with a String type parameter. + */ +@ApiEndpoint( + name = "getDocumentGroupTemplateRecipients", + url = "/v2/document-group-templates/{template_id}/recipients", + method = "get", + auth = "bearer", + namespace = "documentGroupTemplate", + entity = "documentGroupTemplateRecipients", + type = "application/json") +public final class DocumentGroupTemplateRecipientsGetRequest implements RequestInterface { + + /** + * A map to hold the URI parameters for the request. + */ + private final Map uriParams = new HashMap<>(); + + /** + * Sets the document group template id in the URI parameters. + * + * @param templateId The id of the document group template. + * @return The current instance of DocumentGroupTemplateRecipientsGetRequest. + */ + public DocumentGroupTemplateRecipientsGetRequest withTemplateId(String templateId) { + this.uriParams.put("template_id", templateId); + return this; + } + + /** + * Returns the URI parameters for the request. + * + * @return A new HashMap containing the URI parameters. + */ + @NotNull + @Override + public HashMap uriParams() { + return new HashMap<>(this.uriParams); + } + + /** + * Returns the payload for the request. + * + * @return A new HashMap as the payload for the request. + */ + @NotNull + @Override + public Map payload() { + return new HashMap<>(); + } +} diff --git a/src/main/java/com/signnow/api/documentgrouptemplate/request/DocumentGroupTemplateRecipientsPutRequest.java b/src/main/java/com/signnow/api/documentgrouptemplate/request/DocumentGroupTemplateRecipientsPutRequest.java new file mode 100644 index 0000000..b6c6ca0 --- /dev/null +++ b/src/main/java/com/signnow/api/documentgrouptemplate/request/DocumentGroupTemplateRecipientsPutRequest.java @@ -0,0 +1,168 @@ +/* + * This file is a part of signNow SDK API client. + * + * (с) Copyright © 2011-present airSlate Inc. (https://www.signnow.com) + * + * For more details on copyright, see LICENSE.md file + * that was distributed with this source code. + */ + +package com.signnow.api.documentgrouptemplate.request; + +import com.signnow.core.request.ApiEndpoint; +import com.signnow.core.request.RequestInterface; +import com.signnow.api.documentgroup.request.data.CcCollection; +import com.signnow.api.documentgroup.request.data.GeneralReminder; +import com.signnow.api.documentgroup.request.data.recipient.RecipientCollection; + +import java.util.HashMap; +import java.util.Map; + +/** + * This class represents a request to update document group template recipients. + * It implements the RequestInterface with Object type. + */ +@ApiEndpoint( + name = "updateDocumentGroupTemplateRecipients", + url = "/v2/document-group-templates/{template_id}/recipients", + method = "put", + auth = "bearer", + namespace = "documentGroupTemplate", + entity = "documentGroupTemplateRecipients", + type = "application/json") +public final class DocumentGroupTemplateRecipientsPutRequest implements RequestInterface { + + private final RecipientCollection recipients; + + private final CcCollection cc; + + private final Integer generalExpirationDays; + + private final GeneralReminder generalReminder; + + private final String orderType; + + private final HashMap uriParams = new HashMap<>(); + + /** + * Constructs a new DocumentGroupTemplateRecipientsPutRequest with the specified recipients and cc. + * + * @param recipients the collection of recipients + * @param cc the collection of cc + */ + public DocumentGroupTemplateRecipientsPutRequest(RecipientCollection recipients, CcCollection cc) { + this(recipients, cc, null, null, null); + } + + /** + * Constructs a new DocumentGroupTemplateRecipientsPutRequest with all fields. + * + * @param recipients the collection of recipients + * @param cc the collection of cc + * @param generalExpirationDays the number of general expiration days + * @param generalReminder the general reminder + * @param orderType the order type (at_the_same_time, recipient_order, advanced_order) + */ + public DocumentGroupTemplateRecipientsPutRequest( + RecipientCollection recipients, + CcCollection cc, + Integer generalExpirationDays, + GeneralReminder generalReminder, + String orderType) { + this.recipients = recipients != null ? recipients : new RecipientCollection(); + this.cc = cc != null ? cc : new CcCollection(); + this.generalExpirationDays = generalExpirationDays; + this.generalReminder = generalReminder; + this.orderType = orderType; + } + + /** + * Returns the collection of recipients. + * + * @return the collection of recipients + */ + public RecipientCollection getRecipients() { + return this.recipients; + } + + /** + * Returns the collection of cc. + * + * @return the collection of cc + */ + public CcCollection getCc() { + return this.cc; + } + + /** + * Returns the number of general expiration days. + * + * @return the number of general expiration days, or null if not set + */ + public Integer getGeneralExpirationDays() { + return this.generalExpirationDays; + } + + /** + * Returns the general reminder. + * + * @return the general reminder, or null if not set + */ + public GeneralReminder getGeneralReminder() { + return this.generalReminder; + } + + /** + * Returns the order type. + * + * @return the order type, or null if not set + */ + public String getOrderType() { + return this.orderType; + } + + /** + * Sets the document group template ID in the URI parameters. + * + * @param templateId the document group template ID + * @return the current instance of DocumentGroupTemplateRecipientsPutRequest + */ + public DocumentGroupTemplateRecipientsPutRequest withTemplateId(String templateId) { + if (templateId != null) { + this.uriParams.put("template_id", templateId); + } + return this; + } + + /** + * Returns a HashMap containing the URI parameters as key-value pairs. + * + * @return a HashMap containing the URI parameters + */ + @Override + public HashMap uriParams() { + return this.uriParams; + } + + /** + * Returns a Map with the payload of the request. + * + * @return a Map with the payload of the request + */ + @Override + public Map payload() { + Map map = new HashMap<>(); + map.put("recipients", this.recipients != null ? this.recipients.toArray() : new Object[0]); + map.put("cc", this.cc != null ? this.cc.toArray() : new Object[0]); + if (this.generalExpirationDays != null) { + map.put("general_expiration_days", this.generalExpirationDays); + } + if (this.generalReminder != null) { + map.put("general_reminder", this.generalReminder.toMap()); + } + if (this.orderType != null) { + map.put("order_type", this.orderType); + } + return map; + } +} diff --git a/src/main/java/com/signnow/api/documentgrouptemplate/response/DocumentGroupTemplateRecipientsGetResponse.java b/src/main/java/com/signnow/api/documentgrouptemplate/response/DocumentGroupTemplateRecipientsGetResponse.java new file mode 100644 index 0000000..c38b38d --- /dev/null +++ b/src/main/java/com/signnow/api/documentgrouptemplate/response/DocumentGroupTemplateRecipientsGetResponse.java @@ -0,0 +1,45 @@ +/* + * This file is a part of signNow SDK API client. + * + * (с) Copyright © 2011-present airSlate Inc. (https://www.signnow.com) + * + * For more details on copyright, see LICENSE.md file + * that was distributed with this source code. + */ + +package com.signnow.api.documentgrouptemplate.response; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.signnow.api.documentgroup.response.data.data.Data; + +/** + * This class represents the response for getting document group template recipients. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class DocumentGroupTemplateRecipientsGetResponse { + + /** + * The data associated with the document group template recipients. + */ + @JsonProperty("data") + private final Data data; + + /** + * Constructs a new DocumentGroupTemplateRecipientsGetResponse with the specified data. + * + * @param data the data associated with the document group template recipients. + */ + public DocumentGroupTemplateRecipientsGetResponse(@JsonProperty("data") Data data) { + this.data = data; + } + + /** + * Returns the data associated with the document group template recipients. + * + * @return the data associated with the document group template recipients. + */ + public Data getData() { + return this.data; + } +} diff --git a/src/main/java/com/signnow/api/documentgrouptemplate/response/DocumentGroupTemplateRecipientsPutResponse.java b/src/main/java/com/signnow/api/documentgrouptemplate/response/DocumentGroupTemplateRecipientsPutResponse.java new file mode 100644 index 0000000..641779d --- /dev/null +++ b/src/main/java/com/signnow/api/documentgrouptemplate/response/DocumentGroupTemplateRecipientsPutResponse.java @@ -0,0 +1,45 @@ +/* + * This file is a part of signNow SDK API client. + * + * (с) Copyright © 2011-present airSlate Inc. (https://www.signnow.com) + * + * For more details on copyright, see LICENSE.md file + * that was distributed with this source code. + */ + +package com.signnow.api.documentgrouptemplate.response; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.signnow.api.documentgroup.response.data.data.Data; + +/** + * This class represents the response for updating document group template recipients. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class DocumentGroupTemplateRecipientsPutResponse { + + /** + * The data associated with the document group template recipients. + */ + @JsonProperty("data") + private final Data data; + + /** + * Constructs a new DocumentGroupTemplateRecipientsPutResponse with the specified data. + * + * @param data the data associated with the document group template recipients. + */ + public DocumentGroupTemplateRecipientsPutResponse(@JsonProperty("data") Data data) { + this.data = data; + } + + /** + * Returns the data associated with the document group template recipients. + * + * @return the data associated with the document group template recipients. + */ + public Data getData() { + return this.data; + } +} diff --git a/src/main/java/com/signnow/api/folder/response/data/document/FieldDocument.java b/src/main/java/com/signnow/api/folder/response/data/document/FieldDocument.java index 1a52047..fafd817 100644 --- a/src/main/java/com/signnow/api/folder/response/data/document/FieldDocument.java +++ b/src/main/java/com/signnow/api/folder/response/data/document/FieldDocument.java @@ -88,6 +88,12 @@ public final class FieldDocument extends ApiData { @JsonProperty("field_id") private final String fieldId; + /** + * Whether the field request is canceled. + */ + @JsonProperty("field_request_canceled") + private final Boolean fieldRequestCanceled; + /** * Constructor for FieldDocument. * @@ -102,6 +108,7 @@ public final class FieldDocument extends ApiData { * @param elementId The element id of the FieldDocument. * @param templateFieldId The template field id of the FieldDocument. * @param fieldId The field id of the FieldDocument. + * @param fieldRequestCanceled Whether the field request is canceled. */ @JsonCreator public FieldDocument( @@ -115,7 +122,8 @@ public FieldDocument( @JsonProperty("field_request_id") String fieldRequestId, @JsonProperty("element_id") String elementId, @JsonProperty("template_field_id") String templateFieldId, - @JsonProperty("field_id") String fieldId) { + @JsonProperty("field_id") String fieldId, + @JsonProperty("field_request_canceled") Boolean fieldRequestCanceled) { this.id = id; this.type = type; this.roleId = roleId; @@ -127,6 +135,7 @@ public FieldDocument( this.elementId = elementId; this.templateFieldId = templateFieldId; this.fieldId = fieldId; + this.fieldRequestCanceled = fieldRequestCanceled; } /** @@ -228,6 +237,15 @@ public String getFieldId() { return this.fieldId; } + /** + * Returns whether the field request is canceled. + * + * @return true if the field request is canceled, null if not set. + */ + public Boolean isFieldRequestCanceled() { + return this.fieldRequestCanceled; + } + /** * Converts the FieldDocument object to a Map. * @@ -248,6 +266,7 @@ public Map toMap() { map.put("element_id", this.getElementId()); map.put("template_field_id", this.getTemplateFieldId()); map.put("field_id", this.getFieldId()); + map.put("field_request_canceled", this.isFieldRequestCanceled()); return map; } @@ -271,6 +290,7 @@ public static FieldDocument fromMap(@NotNull Map data) { (String) data.getOrDefault("field_request_id", null), (String) data.getOrDefault("element_id", null), (String) data.getOrDefault("template_field_id", null), - (String) data.getOrDefault("field_id", null)); + (String) data.getOrDefault("field_id", null), + (Boolean) data.getOrDefault("field_request_canceled", null)); } } diff --git a/src/main/java/com/signnow/api/folder/response/data/document/JsonAttribute.java b/src/main/java/com/signnow/api/folder/response/data/document/JsonAttribute.java index 5687e12..91b168e 100644 --- a/src/main/java/com/signnow/api/folder/response/data/document/JsonAttribute.java +++ b/src/main/java/com/signnow/api/folder/response/data/document/JsonAttribute.java @@ -142,6 +142,12 @@ public final class JsonAttribute extends ApiData { @JsonProperty("max_chars") private final Integer maxChars; + /** + * Whether the attribute should stretch to fit the document grid. + */ + @JsonProperty("stretch_to_grid") + private final Boolean stretchToGrid; + /** * Constructor for JsonAttribute. * @@ -165,6 +171,7 @@ public final class JsonAttribute extends ApiData { * @param arrangement the arrangement * @param maxLines the maximum number of lines * @param maxChars the maximum number of characters + * @param stretchToGrid whether the attribute should stretch to fit the document grid */ @JsonCreator public JsonAttribute( @@ -187,7 +194,8 @@ public JsonAttribute( @JsonProperty("font_size") Integer fontSize, @JsonProperty("arrangement") String arrangement, @JsonProperty("max_lines") Integer maxLines, - @JsonProperty("max_chars") Integer maxChars) { + @JsonProperty("max_chars") Integer maxChars, + @JsonProperty("stretch_to_grid") Boolean stretchToGrid) { this.pageNumber = pageNumber; this.x = x; this.y = y; @@ -208,6 +216,7 @@ public JsonAttribute( this.arrangement = arrangement; this.maxLines = maxLines; this.maxChars = maxChars; + this.stretchToGrid = stretchToGrid; } /** @@ -390,6 +399,15 @@ public Integer getMaxChars() { return this.maxChars; } + /** + * Returns whether the attribute should stretch to fit the document grid. + * + * @return true if the attribute should stretch to grid, false or null otherwise + */ + public Boolean isStretchToGrid() { + return this.stretchToGrid; + } + /** * Converts this object to a map. * @@ -419,6 +437,7 @@ public Map toMap() { map.put("arrangement", this.getArrangement()); map.put("max_lines", this.getMaxLines()); map.put("max_chars", this.getMaxChars()); + map.put("stretch_to_grid", this.isStretchToGrid()); return map; } @@ -451,6 +470,7 @@ public static JsonAttribute fromMap(@NotNull Map data) { (Integer) data.getOrDefault("font_size", null), (String) data.getOrDefault("arrangement", null), (Integer) data.getOrDefault("max_lines", null), - (Integer) data.getOrDefault("max_chars", null)); + (Integer) data.getOrDefault("max_chars", null), + (Boolean) data.getOrDefault("stretch_to_grid", null)); } } \ No newline at end of file diff --git a/src/main/java/com/signnow/api/user/response/data/premiumaccess/Plan.java b/src/main/java/com/signnow/api/user/response/data/premiumaccess/Plan.java index 93a2a5b..4a0dd41 100644 --- a/src/main/java/com/signnow/api/user/response/data/premiumaccess/Plan.java +++ b/src/main/java/com/signnow/api/user/response/data/premiumaccess/Plan.java @@ -100,6 +100,12 @@ public final class Plan extends ApiData { @JsonProperty("is_marketplace") private final boolean isMarketplace; + /** + * The mobile plan type. + */ + @JsonProperty("mobile_plan_type") + private final String mobilePlanType; + /** * Constructor for the Plan class. * @@ -116,6 +122,7 @@ public final class Plan extends ApiData { * @param unitPrice The unit price of the plan. * @param isTrial The trial status of the plan. * @param isMarketplace The marketplace status of the plan. + * @param mobilePlanType The mobile plan type. */ @JsonCreator public Plan( @@ -131,7 +138,8 @@ public Plan( @JsonProperty("api_requests") int apiRequests, @JsonProperty("unit_price") int unitPrice, @JsonProperty("is_trial") boolean isTrial, - @JsonProperty("is_marketplace") boolean isMarketplace) { + @JsonProperty("is_marketplace") boolean isMarketplace, + @JsonProperty("mobile_plan_type") String mobilePlanType) { this.id = id; this.planId = planId; this.name = name; @@ -145,6 +153,7 @@ public Plan( this.unitPrice = unitPrice; this.isTrial = isTrial; this.isMarketplace = isMarketplace; + this.mobilePlanType = mobilePlanType; } /** @@ -264,6 +273,15 @@ public boolean isMarketplace() { return this.isMarketplace; } + /** + * Returns the mobile plan type. + * + * @return The mobile plan type. + */ + public String getMobilePlanType() { + return this.mobilePlanType; + } + /** * Converts the Plan object to a Map. * @@ -286,6 +304,7 @@ public Map toMap() { map.put("unit_price", this.getUnitPrice()); map.put("is_trial", this.isTrial()); map.put("is_marketplace", this.isMarketplace()); + map.put("mobile_plan_type", this.getMobilePlanType()); return map; } @@ -311,6 +330,7 @@ public static Plan fromMap(@NotNull Map data) { (int) data.get("api_requests"), (int) data.get("unit_price"), (boolean) data.get("is_trial"), - (boolean) data.get("is_marketplace")); + (boolean) data.get("is_marketplace"), + (String) data.getOrDefault("mobile_plan_type", null)); } } \ No newline at end of file diff --git a/src/main/java/com/signnow/api/webhook/request/SubscriptionDeleteRequest.java b/src/main/java/com/signnow/api/webhook/request/SubscriptionDeleteRequest.java index bb0c57e..49528f7 100644 --- a/src/main/java/com/signnow/api/webhook/request/SubscriptionDeleteRequest.java +++ b/src/main/java/com/signnow/api/webhook/request/SubscriptionDeleteRequest.java @@ -22,9 +22,8 @@ */ @ApiEndpoint( name = "deleteEventSubscription", - url = "/api/v2/events/{event_subscription_id}", + url = "/v2/event-subscriptions/{event_subscription_id}", method = "delete", - auth = "basic", namespace = "webhook", entity = "subscription", type = "application/json") diff --git a/src/main/java/com/signnow/core/ApiClient.java b/src/main/java/com/signnow/core/ApiClient.java index 65d7e24..36f7451 100644 --- a/src/main/java/com/signnow/core/ApiClient.java +++ b/src/main/java/com/signnow/core/ApiClient.java @@ -100,13 +100,18 @@ public Reply send(RequestInterface request) throws SignNowApiException + "Please try again later, or check your internet connection."); } + Map responseHeaders = new java.util.LinkedHashMap<>(); + for (String name : response.headers().names()) { + responseHeaders.put(name, response.header(name)); + } ResponseData responseData = new ResponseData( response.code(), response.header("Content-Type", ""), response.header("Content-Disposition", ""), this.configRepository.downloadsDirectory(), - response.body().bytes()); + response.body().bytes(), + responseHeaders); response.close(); responseCode = responseData.getCode(); diff --git a/src/main/java/com/signnow/core/config/ConfigRepository.java b/src/main/java/com/signnow/core/config/ConfigRepository.java index 1d6ba97..14b83bf 100644 --- a/src/main/java/com/signnow/core/config/ConfigRepository.java +++ b/src/main/java/com/signnow/core/config/ConfigRepository.java @@ -15,9 +15,8 @@ /** This class represents all the signNow SDK API configuration file entries as a repository. */ public class ConfigRepository { - private static final int READ_TIMEOUT = 15; - private static final String CLIENT_NAME = "SignNowApiClient/v3.5.1 (Java)"; - + private static final String DEFAULT_READ_TIMEOUT = "30"; + private static final String CLIENT_NAME = "SignNowApiClient/v3.5.2 (Java)"; private final Map configMap; /** @@ -100,6 +99,6 @@ public String clientName() { * @return the read timeout as an integer */ public int readTimeout() { - return READ_TIMEOUT; + return Integer.parseInt(this.configMap.getOrDefault("SIGNNOW_API_TIMEOUT", DEFAULT_READ_TIMEOUT)); } } diff --git a/src/main/java/com/signnow/core/data/ResponseData.java b/src/main/java/com/signnow/core/data/ResponseData.java index 22e8b5c..dd1913a 100644 --- a/src/main/java/com/signnow/core/data/ResponseData.java +++ b/src/main/java/com/signnow/core/data/ResponseData.java @@ -10,6 +10,7 @@ package com.signnow.core.data; import java.nio.charset.StandardCharsets; +import java.util.Collections; import java.util.UUID; import java.util.Map; import java.util.Set; @@ -40,6 +41,9 @@ public class ResponseData { /** The raw content of the response as a byte array. */ private final byte[] content; + /** The HTTP response headers. */ + private final Map headers; + /** * Constructs a new {@code ResponseData} instance. * @@ -56,11 +60,32 @@ public ResponseData( String contentDisposition, String downloadDirectory, byte[] content) { + this(code, contentType, contentDisposition, downloadDirectory, content, Collections.emptyMap()); + } + + /** + * Constructs a new {@code ResponseData} instance with headers. + * + * @param code the HTTP status code + * @param contentType the content type of the response + * @param contentDisposition the content disposition parsed from the response + * @param downloadDirectory the directory where the response content should be downloaded + * @param content the raw body content of the response + * @param headers the HTTP response headers + */ + public ResponseData( + int code, + String contentType, + String contentDisposition, + String downloadDirectory, + byte[] content, + Map headers) { this.code = code; this.contentType = contentType; this.contentDisposition = contentDisposition; this.downloadDirectory = downloadDirectory; this.content = content; + this.headers = headers != null ? headers : Collections.emptyMap(); } /** @@ -90,6 +115,15 @@ public String getContentAsString() { return new String(this.getContent(), StandardCharsets.UTF_8); } + /** + * Returns the HTTP response headers. + * + * @return an unmodifiable map of response headers + */ + public Map getHeaders() { + return Collections.unmodifiableMap(this.headers); + } + /** * Returns the directory where the response content should be downloaded, if applicable. * diff --git a/src/main/java/com/signnow/core/response/Reply.java b/src/main/java/com/signnow/core/response/Reply.java index 8917da7..1505c9d 100644 --- a/src/main/java/com/signnow/core/response/Reply.java +++ b/src/main/java/com/signnow/core/response/Reply.java @@ -9,6 +9,11 @@ package com.signnow.core.response; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Locale; +import java.util.Map; + /** * This class represents a server reply. * @@ -18,6 +23,7 @@ public class Reply { private final Integer httpStatusCode; private final String json; private final R response; + private final Map headers; /** * Constructs a new Reply object. @@ -25,11 +31,23 @@ public class Reply { * @param httpStatusCode the HTTP status code of the server response * @param json the raw JSON string of the server response * @param response the deserialized response body + * @param headers the HTTP response headers */ - public Reply(Integer httpStatusCode, String json, R response) { + public Reply(Integer httpStatusCode, String json, R response, Map headers) { this.httpStatusCode = httpStatusCode; this.json = json; this.response = response; + if (headers == null || headers.isEmpty()) { + this.headers = Collections.emptyMap(); + } else { + Map normalized = new LinkedHashMap<>(); + for (Map.Entry entry : headers.entrySet()) { + if (entry.getKey() != null) { + normalized.put(entry.getKey().toLowerCase(Locale.ROOT), entry.getValue()); + } + } + this.headers = Collections.unmodifiableMap(normalized); + } } /** @@ -71,6 +89,28 @@ public String toJson() { return this.json; } + /** + * Returns the HTTP response headers. + * + * @return an unmodifiable map of response headers + */ + public Map getHeaders() { + return this.headers; + } + + /** + * Returns a specific HTTP response header value. Header name lookup is case-insensitive. + * + * @param name the header name (case-insensitive) + * @return the header value, or null if not present + */ + public String getHeader(String name) { + if (name == null) { + return null; + } + return this.headers.get(name.toLowerCase(Locale.ROOT)); + } + /** * Returns the deserialized response body. * diff --git a/src/main/java/com/signnow/core/response/ResponseParser.java b/src/main/java/com/signnow/core/response/ResponseParser.java index 712113f..3ee7f67 100644 --- a/src/main/java/com/signnow/core/response/ResponseParser.java +++ b/src/main/java/com/signnow/core/response/ResponseParser.java @@ -90,7 +90,7 @@ private static Reply parseFile(Class clazz, ResponseData downloadData) try { Constructor constructor = clazz.getConstructor(File.class); R response = (R) constructor.newInstance(file); - return new Reply<>(downloadData.getCode(), "{}", response); + return new Reply<>(downloadData.getCode(), "{}", response, downloadData.getHeaders()); } catch (NoSuchMethodException | InstantiationException | IllegalAccessException @@ -117,7 +117,7 @@ private static Reply parseJson( jsonResponse = "{}"; } R response = objectMapper.readValue(jsonResponse, responseType); - return new Reply<>(responseData.getCode(), jsonResponse, response); + return new Reply<>(responseData.getCode(), jsonResponse, response, responseData.getHeaders()); } catch (JsonProcessingException e) { throw new SignNowApiException( String.format( diff --git a/src/test/java/com/signnow/api/documentgrouptemplate/DocumentGroupTemplateRecipientsTest.java b/src/test/java/com/signnow/api/documentgrouptemplate/DocumentGroupTemplateRecipientsTest.java new file mode 100644 index 0000000..6ebb13b --- /dev/null +++ b/src/test/java/com/signnow/api/documentgrouptemplate/DocumentGroupTemplateRecipientsTest.java @@ -0,0 +1,93 @@ +/* + * This file is a part of signNow SDK API client. + * + * (с) Copyright © 2011-present airSlate Inc. (https://www.signnow.com) + * + * For more details on copyright, see LICENSE.md file + * that was distributed with this source code. + */ + +package com.signnow.api.documentgrouptemplate; + +import static org.junit.jupiter.api.Assertions.*; + +import com.signnow.BaseTest; +import com.signnow.api.documentgrouptemplate.request.DocumentGroupTemplateRecipientsGetRequest; +import com.signnow.api.documentgrouptemplate.request.DocumentGroupTemplateRecipientsPutRequest; +import com.signnow.api.documentgrouptemplate.response.DocumentGroupTemplateRecipientsGetResponse; +import com.signnow.api.documentgrouptemplate.response.DocumentGroupTemplateRecipientsPutResponse; +import com.signnow.core.ApiClient; +import com.signnow.core.exception.SignNowApiException; +import com.signnow.mock.expectation.Expectation; +import com.signnow.mock.faker.SignNowFaker; +import com.signnow.api.documentgroup.request.data.CcCollection; +import com.signnow.api.documentgroup.request.data.GeneralReminder; +import com.signnow.api.documentgroup.request.data.recipient.RecipientCollection; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class DocumentGroupTemplateRecipientsTest extends BaseTest { + + private ApiClient apiClient; + + private SignNowFaker faker; + + private Expectation expectation; + + @BeforeEach + public void setUp() { + try { + apiClient = this.client(); + } catch (SignNowApiException e) { + fail(e.getMessage()); + } + faker = this.faker(); + } + + @Test + public void testGetDocumentGroupTemplateRecipients() { + expectation = this.expectation("get_document_group_template_recipients", "get"); + + DocumentGroupTemplateRecipientsGetRequest request = new DocumentGroupTemplateRecipientsGetRequest(); + request.withTemplateId(faker.templateId()); + + assertDoesNotThrow( + () -> { + DocumentGroupTemplateRecipientsGetResponse response = (DocumentGroupTemplateRecipientsGetResponse) apiClient.send(request).getResponse(); + + assertNotNull(response, "DocumentGroupTemplateRecipientsGetResponse should not be null."); + assertNotNull(response.getData(), "Data should not be null."); + assertNotNull(response.getData().getGeneralExpirationDays(), "General expiration days should not be null."); + assertNotNull(response.getData().getGeneralReminder(), "General reminder should not be null."); + assertNotNull(response.getData().getOrderType(), "Order type should not be null."); + this.assertSame(expectation.get("data"), response.getData()); + }, + "Sending DocumentGroupTemplateRecipientsGetRequest should not throw any exception."); + } + + @Test + public void testPutDocumentGroupTemplateRecipients() { + expectation = this.expectation("update_document_group_template_recipients", "put"); + + RecipientCollection recipients = new RecipientCollection(); + CcCollection cc = new CcCollection(); + GeneralReminder generalReminder = new GeneralReminder(1, 5, 3); + + DocumentGroupTemplateRecipientsPutRequest request = new DocumentGroupTemplateRecipientsPutRequest( + recipients, cc, 30, generalReminder, "recipient_order"); + request.withTemplateId(faker.templateId()); + + assertDoesNotThrow( + () -> { + DocumentGroupTemplateRecipientsPutResponse response = (DocumentGroupTemplateRecipientsPutResponse) apiClient.send(request).getResponse(); + + assertNotNull(response, "DocumentGroupTemplateRecipientsPutResponse should not be null."); + assertNotNull(response.getData(), "Data should not be null."); + assertNotNull(response.getData().getGeneralExpirationDays(), "General expiration days should not be null."); + assertNotNull(response.getData().getGeneralReminder(), "General reminder should not be null."); + assertNotNull(response.getData().getOrderType(), "Order type should not be null."); + this.assertSame(expectation.get("data"), response.getData()); + }, + "Sending DocumentGroupTemplateRecipientsPutRequest should not throw any exception."); + } +} diff --git a/src/test/java/com/signnow/core/config/ConfigRepositoryTest.java b/src/test/java/com/signnow/core/config/ConfigRepositoryTest.java index e394b34..3f7d352 100644 --- a/src/test/java/com/signnow/core/config/ConfigRepositoryTest.java +++ b/src/test/java/com/signnow/core/config/ConfigRepositoryTest.java @@ -43,6 +43,7 @@ public void testConfigLoading() { assertEquals("test!PAZZW", configRepository.password()); assertInstanceOf(BasicToken.class, configRepository.basicToken()); assertEquals("test_basic_token", configRepository.basicToken().token()); + assertEquals(55, configRepository.readTimeout()); assertEquals(System.getProperty("user.dir"), configRepository.projectDirectory()); assertEquals( configRepository.projectDirectory() + "/src/main/resources/downloads", diff --git a/src/test/resources/.env.test b/src/test/resources/.env.test index 47de441..2b0a245 100644 --- a/src/test/resources/.env.test +++ b/src/test/resources/.env.test @@ -6,5 +6,5 @@ SIGNNOW_API_HOST=http://127.0.0.1:8086 SIGNNOW_API_BASIC_TOKEN=c2lnbk5vdyBBUEkgc2FtcGxlIEFwcCB2MS4wCg== SIGNNOW_API_USERNAME=user@signnow.com SIGNNOW_API_PASSWORD=coolest_pazzw0rd - +SIGNNOW_API_TIMEOUT=55 SIGNNOW_DOWNLOADS_DIR=./src/main/resources/downloads diff --git a/src/test/resources/mock_config.env b/src/test/resources/mock_config.env index 00ee9e3..cf452dd 100644 --- a/src/test/resources/mock_config.env +++ b/src/test/resources/mock_config.env @@ -6,4 +6,5 @@ SIGNNOW_API_HOST=https://api.test.not.exist.signnow.com SIGNNOW_API_BASIC_TOKEN=test_basic_token SIGNNOW_API_USERNAME=user-test@signnow.com SIGNNOW_API_PASSWORD=test!PAZZW +SIGNNOW_API_TIMEOUT=55 SIGNNOW_DOWNLOADS_DIR=./src/main/resources/downloads diff --git a/src/test/resources/wiremock/mappings/get_document_get.json b/src/test/resources/wiremock/mappings/get_document_get.json index 0950ede..f429db9 100644 --- a/src/test/resources/wiremock/mappings/get_document_get.json +++ b/src/test/resources/wiremock/mappings/get_document_get.json @@ -5,9 +5,9 @@ }, "response": { "status": 200, - "body": "{\"id\":\"e2e913db4ba9815a31c8a28a196b7df96fe1cc46\",\"user_id\":\"a8277972fe195eb7a9f86db0e9e33dffa55deac9\",\"document_name\":\"eaet ter\",\"page_count\":\"0\",\"created\":332223105,\"is_template\":false,\"updated\":78692571,\"original_filename\":\"ea.doc\",\"owner\":\"evan69@yahoo.com\",\"owner_name\":\"Lia Legros\",\"template\":false,\"parent_id\":\"09588059592430c7bf6c3a2baacfc48694966d67\",\"originator_logo\":\"\",\"pages\":[{\"src\":\"https:\\/\\/api.signnow.com\\/document\\/29ab8396df93d14aeb676cbeef60901362861d69\\/thumbnail?size=large&page=0\",\"size\":{\"width\":829,\"height\":348}}],\"version_time\":1260995138,\"routing_details\":[{\"id\":\"bac6c72343c0f2f4e1675f62615bf4393ec0bb7d\",\"data\":[{\"default_email\":\"bayer.imani@herman.com\",\"inviter_role\":true,\"name\":\"Signer\",\"role_id\":\"340495da66cde18ba68dfd78c964b3ee74b9988f\",\"signing_order\":1230}],\"created\":1045893054,\"updated\":1045893054}],\"thumbnail\":{\"small\":\"https:\\/\\/api.signnow.com\\/document\\/0161dc5c9cf90e0499bc049f0d930f2348b6ee1e\\/thumbnail?size=small\",\"medium\":\"https:\\/\\/api.signnow.com\\/document\\/0161dc5c9cf90e0499bc049f0d930f2348b6ee1e\\/thumbnail?size=medium\",\"large\":\"https:\\/\\/api.signnow.com\\/document\\/0161dc5c9cf90e0499bc049f0d930f2348b6ee1e\\/thumbnail?size=large\"},\"signatures\":[{\"id\":\"2d74aabcd91cb312bce8c97fde38c62918d42b8f\",\"user_id\":\"fc5642a54f796a224b4a88f0a22f40d893419888\",\"signature_request_id\":\"9524bc5c1271dcf316b006c8975d0b25da12c9d0\",\"email\":\"laisha.dickens@johnson.com\",\"page_number\":\"harum\",\"width\":\"aut\",\"height\":\"consequatur\",\"x\":\"voluptatem\",\"y\":\"temporibus\",\"subtype\":\"doloribus\",\"allow_editing\":false,\"owner_as_recipient\":true,\"created\":659085581,\"data\":\"iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAApSURBVAiZVcvBCQAgEMTAObH\\/itX1IYgG8ksqc8RDA9WO6CDrFpXkWzZ2uwn\\/AFD5ZAAAAABJRU5ErkJggg==\"}],\"tags\":[{\"type\":\"aliquid\",\"name\":\"error\"}],\"fields\":[{\"id\":\"76f7e03d447cde2aa4fede21d2fceb5011ea5052\",\"type\":\"rem\",\"role_id\":\"b9a845f5c36909a9acb07aec0de7f3c18767a33e\",\"json_attributes\":{\"page_number\":0,\"x\":12920,\"y\":31445,\"width\":97151,\"height\":34405,\"required\":true,\"name\":\"asperiores\",\"label\":\"illo\",\"color\":\"CE0000\",\"bold\":false,\"italic\":false,\"underline\":false,\"align\":\"left\",\"valign\":\"top\",\"font\":\"Arial\",\"font_size\":9,\"size\":14,\"arrangement\":\"none\",\"max_lines\":27516,\"max_chars\":29326,\"validator_id\":\"82af84f6b43c7ebf30c9af66ec5f040859073ece\",\"prefilled_text\":\"demo\"},\"role\":\"voluptas\",\"originator\":\"smayert@ziemann.net\",\"fulfiller\":\"nya38@ernser.biz\",\"field_request_id\":\"064703e57950efe9abe0fa462bb2bffc2fc80a8b\",\"field_request_canceled\":\"eligendi\",\"element_id\":\"57d0df6c9146fd5b24320a45535a0857a3378373\",\"field_id\":\"2b1763d62a18048094165f90b68f71bdbc89b8e0\",\"template_field_id\":\"dbf6c4fc9b88c9ac276bbe8eeec8f696f51e2c78\"}],\"roles\":[{\"unique_id\":\"ut\",\"signing_order\":\"autem\",\"name\":\"reprehenderit\"}],\"viewer_roles\":[{\"unique_id\":\"accusamus\",\"signing_order\":\"sint\",\"name\":\"reprehenderit\"}],\"signing_session_settings\":{\"welcome_message\":\"nam\"},\"field_invites\":[{\"id\":\"3ac71a4a7bf44de3b25ce6747c3cbec90689bc19\",\"signer_user_id\":\"a5bfc53329924ababfa78490478231b36e428e93\",\"status\":\"pending\",\"password_protected\":\"0\",\"reassign\":\"0\",\"created\":\"1751628601\",\"updated\":\"1751628602\",\"email_group\":{\"id\":null,\"name\":null},\"email\":\"test.user@airslate.com\",\"email_statuses\":[{\"status\":\"sent\",\"created_at\":1751628605,\"last_reaction_at\":1751628605}],\"role\":\"Signer\",\"role_id\":\"3003e0b87b474b3fb5645a1f1eb84f69ea3eaa28\",\"reminder\":\"0\",\"expiration_time\":\"1754220602\",\"redirect_uri\":\"https:\\/\\/example.com\",\"decline_redirect_uri\":\"https:\\/\\/signnow.com\",\"close_redirect_uri\":\"https:\\/\\/close-redirect-uri.com\",\"redirect_target\":\"blank\",\"is_draft_exists\":\"0\",\"is_full_declined\":false,\"is_embedded\":false,\"is_document_locked\":\"0\",\"declined\":[],\"decline_by_signature\":\"0\",\"electronic_consent_required\":0,\"delivery_type\":\"email\",\"id_verification_required\":\"NO\",\"id_verified\":\"UNVERIFIED\",\"stripe_ach_bank_account_verified\":\"0\",\"stripe_ach_bank_account_present\":\"0\",\"embedded_signer\":[],\"prefill_signature_name\":\"Signer 1\",\"force_new_signature\":1,\"compliance\":{\"cfr\":{\"cfr_title_21_part_11\":1,\"front_end_session_length\":\"15\",\"require_authentication_for_invites\":\"1\",\"auto_apply_signatures_and_initials_to_document_fields\":\"0\",\"every_signature_and_initials_field_requires_user_authentication\":\"on\",\"emailed_docs_include_history\":\"1\",\"cloud_export_with_history\":\"1\",\"require_login_for_signing\":\"1\",\"logout_on_signing\":\"1\",\"add_signature_stamp_with_name\":\"1\"}}}],\"enumeration_options\":[{\"id\":\"fa35b2b8896263d132208df7b0bf5249fe343443\",\"enumeration_id\":\"ee528851367a3b5f8d99734f35123adbb861f81e\",\"data\":\"M\",\"created\":\"1739110185\",\"updated\":\"1739110185\",\"json_attributes\":\"[]\"}],\"originator_organization_settings\":[{\"setting\":\"excepturi\",\"value\":\"enim\"}],\"document_group_info\":{\"document_group_id\":\"praesentium\",\"document_group_name\":\"sit\",\"invite_id\":\"iure\",\"invite_status\":\"beatae\",\"sign_as_merged\":false,\"doc_count_in_group\":0,\"freeform_invite\":{\"id\":\"250cc8fa1abf3cb91ba8ea396ee82726164d7547\"},\"state\":\"odit\"},\"settings\":{\"no_document_attachment\":false,\"copy_export\":true,\"no_document_file_attachments\":false,\"no_user_signature_return\":true,\"mobileweb_option\":true,\"require_drawn_signatures\":true,\"org_allowed_team_admins\":false,\"cloud_auto_export\":true,\"digitally_sign_dowloaded_docs\":true,\"invite_completion_redirect_url\":false,\"invite_decline_redirect_url\":true,\"add_signature_stamp\":true,\"pending_invite_document_view_notification\":true,\"signing_link_document_download\":false,\"required_preset_signature_name\":true,\"cloud_export_with_history\":false,\"emailed_docs_include_history\":true,\"require_email_subject\":false,\"document_completion_retention_days\":false,\"enable_hyperlink_protection\":false,\"enable_advanced_threat_protection\":false,\"require_login_for_signing\":false,\"logout_on_signing\":false,\"audit_trail_completion_retention_days\":true,\"front_end_session_length\":false,\"email_admin_on_banned_login\":false,\"add_signature_stamp_with_name\":true,\"cfr_title_21_part_11\":true,\"unsuccessful_logout_attempts_allowed\":false,\"require_authentication_for_invites\":false,\"electronic_consent_required\":true,\"electronic_consent_text\":true,\"document_guide\":true,\"watermark_downloaded_document\":true,\"restrict_download\":true,\"disable_email_notifications\":false,\"upload_limit\":true,\"document_schema_extended\":false,\"invite_update_notifications_for_all_invites_at_invite_create\":true,\"enable_full_story_tracker\":true,\"document_attachment_only_for_signer\":true,\"sso-only-login\":false,\"block_export_options_when_credit_card_validation_is_used\":false,\"only_administrator_is_able_to_invite_to_the_team\":false,\"block_login_via_social_networks\":false,\"redirect_to_registration_when_fields_saved\":false,\"common_experiments\":false,\"hide_decline_to_sign_option_in_signing_session\":false,\"hide_upgrade_subscription_button\":false,\"do_no_consent_redirect_url\":false,\"lock_signing_date_by_default\":false,\"allow_download_certificate\":false,\"have_merged_document_group_option\":false,\"enable_eu_date_format\":false,\"guide_signers_only_through_required_fields\":false,\"allow_document_copying_to_other_accounts\":false,\"email_custom_subject\":false,\"email_custom_message\":false,\"invite_expiration_days\":false,\"enable_mfa\":false,\"enable_document_download_link_for_invite_completion_mails\":false,\"allow_big_attachment_file\":false,\"allow_big_count_of_attachment_fields_per_document\":false,\"enable_hyperlink_field\":false,\"disable_download_action_in_editor\":false,\"signature_stamp_position\":false,\"enable_pki\":false,\"enable_document_comments\":false,\"cc_completion_email_contain_only_downloading_document_link\":false,\"save_signer_signature_and_initials\":false,\"auto_apply_signatures_and_initials_to_document_fields\":false,\"block_organization_selfleave_by_member\":false,\"receive_signer_email_after_sent_field_invite_to_yourself\":false,\"date_format\":false,\"completed_document_name_formula\":false,\"agreement_to_test_new_functionality_in_organization\":false,\"agree_to_be_beta_tester\":false,\"default_field_invite_remind_before\":false,\"default_field_invite_remind_after\":false,\"default_field_invite_remind_repeat\":false,\"default_field_invite_expiration_time\":false,\"email_logo_position\":false,\"email_btn_bkgd_color\":false,\"email_btn_text_color\":false,\"allow_edit_document_after_signing\":false,\"allow_embedded_extended_token_expiration\":false,\"every_signature_and_initials_field_requires_user_authentication\":false,\"enable_render_pages_in_editor_as_images\":false,\"enable_team_admin_move_docs\":false,\"disable_email_recipients\":false,\"allow_team_admin_rename_docs\":false,\"email_footer_enabled\":false,\"parse_only_signature_fields\":false,\"flatten_before_aspose\":false,\"run_experiments\":false,\"disable_form_search\":false,\"allow_team_admin_create_csv_report_for_shared_template\":false,\"enable_team_generic_email\":false,\"use_team_generic_data\":false,\"signing_reason\":false,\"allow_qes\":false,\"enable_qes\":false,\"advanced_signing_flow\":false,\"document_prefill_disable_fields_existing_validation\":false,\"disable_problem_invite_email_notifications\":false,\"default_workspace_assigned\":false,\"workspace_organization\":false,\"default_workspace\":false,\"workspace_subscription_admin\":false,\"dashboard_tips_enabled\":false,\"dashboard_onboarding_enabled\":false,\"dashboard_onboarding_current_step\":false},\"share_info\":{\"is_team_shared\":false,\"role\":\"sender\",\"is_personally_shared_to_others\":true},\"texts\":[{\"id\":\"701454df477a42a88a8c80d01c27dfa1f84a600f\",\"user_id\":\"3de81beb9c314304af47694bd979b0c13b40fe2e\",\"email\":\"illarionova.mariia@pdffiller.team\",\"font\":\"Arial\",\"size\":\"10\",\"data\":\"07\\/11\\/2025\",\"page_number\":\"0\",\"x\":\"452\",\"y\":\"140\",\"width\":76,\"height\":15,\"line_height\":\"9.00\",\"subtype\":\"date\",\"created\":\"1752222502\",\"color\":\"000000\",\"italic\":false,\"underline\":false,\"bold\":false,\"align\":\"left\",\"original_font_size\":\"14.00\",\"is_width_fixed\":false,\"allow_editing\":true,\"owner_as_recipient\":true},{\"id\":\"e7d76381d9c040f79752ab3f319570557b75fbfa\",\"user_id\":\"3de81beb9c314304af47694bd979b0c13b40fe2e\",\"email\":\"illarionova.mariia@pdffiller.team\",\"font\":\"Arial\",\"size\":\"8\",\"data\":\"hdfj\",\"page_number\":\"0\",\"x\":\"210\",\"y\":\"176\",\"width\":261,\"height\":21,\"line_height\":\"9.00\",\"subtype\":\"text\",\"created\":\"1752222502\",\"color\":\"000000\",\"italic\":false,\"underline\":false,\"bold\":false,\"align\":\"left\",\"original_font_size\":\"12.00\",\"is_width_fixed\":false,\"allow_editing\":true,\"owner_as_recipient\":true}],\"origin_document_id\": \"de45a9a2a6014c2c8ac0a4d9057b17a2108e77e7\",\"origin_user_id\": \"a05f0e51d7fc45bea48e05666b4c2b6f238aabad\",\"approver_roles\": [],\"attachments\": [],\"checks\": [],\"document_group_template_info\": [],\"integrations\": [],\"exported_to\": [],\"viewer_field_invites\": [],\"approver_field_invites\": [],\"field_validators\":[{\"id\":\"13435fa6c2a17f83177fcbb5c4a9376ce85befeb\",\"name\":\"Date Only (e.g. 09\\/28\\/2008)\",\"regex_expression\":\"$\",\"description\":\"Please enter a date mm\\/dd\\/yyyy.\",\"scope\":\"system\",\"error_message\":\"Please enter a date (mm\\/dd\\/yyyy).\",\"display_json_attributes\":{\"web_short_name\":\"Date (US) : MM\\/DD\\/YYYY\",\"web_description\":\"Please enter a date mm\\/dd\\/yyyy.\",\"common\":true,\"disabled\":false,\"date_time_field_order\":1,\"text_field_order\":null,\"web_locale_key\":\"SERVER_VALIDATION.FIELDS.DATE_US\"},\"formula_calculation\":\"1\"},{\"id\":\"13435fa6c2a17f83177fcbb5c4a9376ce85befeb\",\"name\":\"Date Only (e.g. 09\\/28\\/2008)\",\"regex_expression\":\"^$\",\"description\":\"Please enter a date mm\\/dd\\/yyyy.\",\"scope\":\"system\",\"error_message\":\"Please enter a date (mm\\/dd\\/yyyy).\",\"display_json_attributes\":{\"web_short_name\":\"Date (US) : MM\\/DD\\/YYYY\",\"web_description\":\"Please enter a date mm\\/dd\\/yyyy.\",\"common\":true,\"disabled\":false,\"date_time_field_order\":1,\"text_field_order\":null,\"web_locale_key\":\"SERVER_VALIDATION.FIELDS.DATE_US\"},\"formula_calculation\":\"1\"}],\"hyperlinks\": [],\"inserts\": [],\"notary_invites\": [],\"payments\": [],\"radiobuttons\": [],\"seals\": [],\"requests\": [],\"lines\": []}", + "body": "{\"id\":\"e2e913db4ba9815a31c8a28a196b7df96fe1cc46\",\"user_id\":\"a8277972fe195eb7a9f86db0e9e33dffa55deac9\",\"document_name\":\"eaet ter\",\"page_count\":\"0\",\"created\":332223105,\"is_template\":false,\"updated\":78692571,\"original_filename\":\"ea.doc\",\"owner\":\"evan69@yahoo.com\",\"owner_name\":\"Lia Legros\",\"template\":false,\"parent_id\":\"09588059592430c7bf6c3a2baacfc48694966d67\",\"originator_logo\":\"\",\"pages\":[{\"src\":\"https://api.signnow.com/document/29ab8396df93d14aeb676cbeef60901362861d69/thumbnail?size=large&page=0\",\"size\":{\"width\":829,\"height\":348}}],\"version_time\":1260995138,\"routing_details\":[{\"id\":\"bac6c72343c0f2f4e1675f62615bf4393ec0bb7d\",\"data\":[{\"default_email\":\"bayer.imani@herman.com\",\"inviter_role\":true,\"name\":\"Signer\",\"role_id\":\"340495da66cde18ba68dfd78c964b3ee74b9988f\",\"signing_order\":1230}],\"created\":1045893054,\"updated\":1045893054}],\"thumbnail\":{\"small\":\"https://api.signnow.com/document/0161dc5c9cf90e0499bc049f0d930f2348b6ee1e/thumbnail?size=small\",\"medium\":\"https://api.signnow.com/document/0161dc5c9cf90e0499bc049f0d930f2348b6ee1e/thumbnail?size=medium\",\"large\":\"https://api.signnow.com/document/0161dc5c9cf90e0499bc049f0d930f2348b6ee1e/thumbnail?size=large\"},\"signatures\":[{\"id\":\"2d74aabcd91cb312bce8c97fde38c62918d42b8f\",\"user_id\":\"fc5642a54f796a224b4a88f0a22f40d893419888\",\"signature_request_id\":\"9524bc5c1271dcf316b006c8975d0b25da12c9d0\",\"email\":\"laisha.dickens@johnson.com\",\"page_number\":\"harum\",\"width\":\"aut\",\"height\":\"consequatur\",\"x\":\"voluptatem\",\"y\":\"temporibus\",\"subtype\":\"doloribus\",\"allow_editing\":false,\"owner_as_recipient\":true,\"created\":659085581,\"data\":\"iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAApSURBVAiZVcvBCQAgEMTAObH/itX1IYgG8ksqc8RDA9WO6CDrFpXkWzZ2uwn/AFD5ZAAAAABJRU5ErkJggg==\"}],\"tags\":[{\"type\":\"aliquid\",\"name\":\"error\"}],\"fields\":[{\"id\":\"76f7e03d447cde2aa4fede21d2fceb5011ea5052\",\"type\":\"rem\",\"role_id\":\"b9a845f5c36909a9acb07aec0de7f3c18767a33e\",\"json_attributes\":{\"page_number\":0,\"x\":12920,\"y\":31445,\"width\":97151,\"height\":34405,\"required\":true,\"name\":\"asperiores\",\"label\":\"illo\",\"color\":\"CE0000\",\"bold\":false,\"italic\":false,\"underline\":false,\"align\":\"left\",\"valign\":\"top\",\"font\":\"Arial\",\"font_size\":9,\"size\":14,\"arrangement\":\"none\",\"max_lines\":27516,\"max_chars\":29326,\"validator_id\":\"82af84f6b43c7ebf30c9af66ec5f040859073ece\",\"prefilled_text\":\"demo\"},\"role\":\"voluptas\",\"originator\":\"smayert@ziemann.net\",\"fulfiller\":\"nya38@ernser.biz\",\"field_request_id\":\"064703e57950efe9abe0fa462bb2bffc2fc80a8b\",\"field_request_canceled\":false,\"element_id\":\"57d0df6c9146fd5b24320a45535a0857a3378373\",\"field_id\":\"2b1763d62a18048094165f90b68f71bdbc89b8e0\",\"template_field_id\":\"dbf6c4fc9b88c9ac276bbe8eeec8f696f51e2c78\"}],\"roles\":[{\"unique_id\":\"ut\",\"signing_order\":\"autem\",\"name\":\"reprehenderit\"}],\"viewer_roles\":[{\"unique_id\":\"accusamus\",\"signing_order\":\"sint\",\"name\":\"reprehenderit\"}],\"signing_session_settings\":{\"welcome_message\":\"nam\"},\"field_invites\":[{\"id\":\"3ac71a4a7bf44de3b25ce6747c3cbec90689bc19\",\"signer_user_id\":\"a5bfc53329924ababfa78490478231b36e428e93\",\"status\":\"pending\",\"password_protected\":\"0\",\"reassign\":\"0\",\"created\":\"1751628601\",\"updated\":\"1751628602\",\"email_group\":{\"id\":null,\"name\":null},\"email\":\"test.user@airslate.com\",\"email_statuses\":[{\"status\":\"sent\",\"created_at\":1751628605,\"last_reaction_at\":1751628605}],\"role\":\"Signer\",\"role_id\":\"3003e0b87b474b3fb5645a1f1eb84f69ea3eaa28\",\"reminder\":\"0\",\"expiration_time\":\"1754220602\",\"redirect_uri\":\"https://example.com\",\"decline_redirect_uri\":\"https://signnow.com\",\"close_redirect_uri\":\"https://close-redirect-uri.com\",\"redirect_target\":\"blank\",\"is_draft_exists\":\"0\",\"is_full_declined\":false,\"is_embedded\":false,\"is_document_locked\":\"0\",\"declined\":[],\"decline_by_signature\":\"0\",\"electronic_consent_required\":0,\"delivery_type\":\"email\",\"id_verification_required\":\"NO\",\"id_verified\":\"UNVERIFIED\",\"stripe_ach_bank_account_verified\":\"0\",\"stripe_ach_bank_account_present\":\"0\",\"embedded_signer\":[],\"prefill_signature_name\":\"Signer 1\",\"force_new_signature\":1,\"compliance\":{\"cfr\":{\"cfr_title_21_part_11\":1,\"front_end_session_length\":\"15\",\"require_authentication_for_invites\":\"1\",\"auto_apply_signatures_and_initials_to_document_fields\":\"0\",\"every_signature_and_initials_field_requires_user_authentication\":\"on\",\"emailed_docs_include_history\":\"1\",\"cloud_export_with_history\":\"1\",\"require_login_for_signing\":\"1\",\"logout_on_signing\":\"1\",\"add_signature_stamp_with_name\":\"1\"}}}],\"enumeration_options\":[{\"id\":\"fa35b2b8896263d132208df7b0bf5249fe343443\",\"enumeration_id\":\"ee528851367a3b5f8d99734f35123adbb861f81e\",\"data\":\"M\",\"created\":\"1739110185\",\"updated\":\"1739110185\",\"json_attributes\":\"[]\"}],\"originator_organization_settings\":[{\"setting\":\"excepturi\",\"value\":\"enim\"}],\"document_group_info\":{\"document_group_id\":\"praesentium\",\"document_group_name\":\"sit\",\"invite_id\":\"iure\",\"invite_status\":\"beatae\",\"sign_as_merged\":false,\"doc_count_in_group\":0,\"freeform_invite\":{\"id\":\"250cc8fa1abf3cb91ba8ea396ee82726164d7547\"},\"state\":\"odit\"},\"settings\":{\"no_document_attachment\":false,\"copy_export\":true,\"no_document_file_attachments\":false,\"no_user_signature_return\":true,\"mobileweb_option\":true,\"require_drawn_signatures\":true,\"org_allowed_team_admins\":false,\"cloud_auto_export\":true,\"digitally_sign_dowloaded_docs\":true,\"invite_completion_redirect_url\":false,\"invite_decline_redirect_url\":true,\"add_signature_stamp\":true,\"pending_invite_document_view_notification\":true,\"signing_link_document_download\":false,\"required_preset_signature_name\":true,\"cloud_export_with_history\":false,\"emailed_docs_include_history\":true,\"require_email_subject\":false,\"document_completion_retention_days\":false,\"enable_hyperlink_protection\":false,\"enable_advanced_threat_protection\":false,\"require_login_for_signing\":false,\"logout_on_signing\":false,\"audit_trail_completion_retention_days\":true,\"front_end_session_length\":false,\"email_admin_on_banned_login\":false,\"add_signature_stamp_with_name\":true,\"cfr_title_21_part_11\":true,\"unsuccessful_logout_attempts_allowed\":false,\"require_authentication_for_invites\":false,\"electronic_consent_required\":true,\"electronic_consent_text\":true,\"document_guide\":true,\"watermark_downloaded_document\":true,\"restrict_download\":true,\"disable_email_notifications\":false,\"upload_limit\":true,\"document_schema_extended\":false,\"invite_update_notifications_for_all_invites_at_invite_create\":true,\"enable_full_story_tracker\":true,\"document_attachment_only_for_signer\":true,\"sso-only-login\":false,\"block_export_options_when_credit_card_validation_is_used\":false,\"only_administrator_is_able_to_invite_to_the_team\":false,\"block_login_via_social_networks\":false,\"redirect_to_registration_when_fields_saved\":false,\"common_experiments\":false,\"hide_decline_to_sign_option_in_signing_session\":false,\"hide_upgrade_subscription_button\":false,\"do_no_consent_redirect_url\":false,\"lock_signing_date_by_default\":false,\"allow_download_certificate\":false,\"have_merged_document_group_option\":false,\"enable_eu_date_format\":false,\"guide_signers_only_through_required_fields\":false,\"allow_document_copying_to_other_accounts\":false,\"email_custom_subject\":false,\"email_custom_message\":false,\"invite_expiration_days\":false,\"enable_mfa\":false,\"enable_document_download_link_for_invite_completion_mails\":false,\"allow_big_attachment_file\":false,\"allow_big_count_of_attachment_fields_per_document\":false,\"enable_hyperlink_field\":false,\"disable_download_action_in_editor\":false,\"signature_stamp_position\":false,\"enable_pki\":false,\"enable_document_comments\":false,\"cc_completion_email_contain_only_downloading_document_link\":false,\"save_signer_signature_and_initials\":false,\"auto_apply_signatures_and_initials_to_document_fields\":false,\"block_organization_selfleave_by_member\":false,\"receive_signer_email_after_sent_field_invite_to_yourself\":false,\"date_format\":false,\"completed_document_name_formula\":false,\"agreement_to_test_new_functionality_in_organization\":false,\"agree_to_be_beta_tester\":false,\"default_field_invite_remind_before\":false,\"default_field_invite_remind_after\":false,\"default_field_invite_remind_repeat\":false,\"default_field_invite_expiration_time\":false,\"email_logo_position\":false,\"email_btn_bkgd_color\":false,\"email_btn_text_color\":false,\"allow_edit_document_after_signing\":false,\"allow_embedded_extended_token_expiration\":false,\"every_signature_and_initials_field_requires_user_authentication\":false,\"enable_render_pages_in_editor_as_images\":false,\"enable_team_admin_move_docs\":false,\"disable_email_recipients\":false,\"allow_team_admin_rename_docs\":false,\"email_footer_enabled\":false,\"parse_only_signature_fields\":false,\"flatten_before_aspose\":false,\"run_experiments\":false,\"disable_form_search\":false,\"allow_team_admin_create_csv_report_for_shared_template\":false,\"enable_team_generic_email\":false,\"use_team_generic_data\":false,\"signing_reason\":false,\"allow_qes\":false,\"enable_qes\":false,\"advanced_signing_flow\":false,\"document_prefill_disable_fields_existing_validation\":false,\"disable_problem_invite_email_notifications\":false,\"default_workspace_assigned\":false,\"workspace_organization\":false,\"default_workspace\":false,\"workspace_subscription_admin\":false,\"dashboard_tips_enabled\":false,\"dashboard_onboarding_enabled\":false,\"dashboard_onboarding_current_step\":false},\"share_info\":{\"is_team_shared\":false,\"role\":\"sender\",\"is_personally_shared_to_others\":true},\"texts\":[{\"id\":\"701454df477a42a88a8c80d01c27dfa1f84a600f\",\"user_id\":\"3de81beb9c314304af47694bd979b0c13b40fe2e\",\"email\":\"illarionova.mariia@pdffiller.team\",\"font\":\"Arial\",\"size\":\"10\",\"data\":\"07/11/2025\",\"page_number\":\"0\",\"x\":\"452\",\"y\":\"140\",\"width\":76,\"height\":15,\"line_height\":\"9.00\",\"subtype\":\"date\",\"created\":\"1752222502\",\"color\":\"000000\",\"italic\":false,\"underline\":false,\"bold\":false,\"align\":\"left\",\"original_font_size\":\"14.00\",\"is_width_fixed\":false,\"allow_editing\":true,\"owner_as_recipient\":true},{\"id\":\"e7d76381d9c040f79752ab3f319570557b75fbfa\",\"user_id\":\"3de81beb9c314304af47694bd979b0c13b40fe2e\",\"email\":\"illarionova.mariia@pdffiller.team\",\"font\":\"Arial\",\"size\":\"8\",\"data\":\"hdfj\",\"page_number\":\"0\",\"x\":\"210\",\"y\":\"176\",\"width\":261,\"height\":21,\"line_height\":\"9.00\",\"subtype\":\"text\",\"created\":\"1752222502\",\"color\":\"000000\",\"italic\":false,\"underline\":false,\"bold\":false,\"align\":\"left\",\"original_font_size\":\"12.00\",\"is_width_fixed\":false,\"allow_editing\":true,\"owner_as_recipient\":true}],\"origin_document_id\":\"de45a9a2a6014c2c8ac0a4d9057b17a2108e77e7\",\"origin_user_id\":\"a05f0e51d7fc45bea48e05666b4c2b6f238aabad\",\"approver_roles\":[],\"attachments\":[],\"checks\":[],\"document_group_template_info\":[],\"integrations\":[],\"exported_to\":[],\"viewer_field_invites\":[],\"approver_field_invites\":[],\"field_validators\":[{\"id\":\"13435fa6c2a17f83177fcbb5c4a9376ce85befeb\",\"name\":\"Date Only (e.g. 09/28/2008)\",\"regex_expression\":\"$\",\"description\":\"Please enter a date mm/dd/yyyy.\",\"scope\":\"system\",\"error_message\":\"Please enter a date (mm/dd/yyyy).\",\"display_json_attributes\":{\"web_short_name\":\"Date (US) : MM/DD/YYYY\",\"web_description\":\"Please enter a date mm/dd/yyyy.\",\"common\":true,\"disabled\":false,\"date_time_field_order\":1,\"text_field_order\":null,\"web_locale_key\":\"SERVER_VALIDATION.FIELDS.DATE_US\"},\"formula_calculation\":\"1\"},{\"id\":\"13435fa6c2a17f83177fcbb5c4a9376ce85befeb\",\"name\":\"Date Only (e.g. 09/28/2008)\",\"regex_expression\":\"^$\",\"description\":\"Please enter a date mm/dd/yyyy.\",\"scope\":\"system\",\"error_message\":\"Please enter a date (mm/dd/yyyy).\",\"display_json_attributes\":{\"web_short_name\":\"Date (US) : MM/DD/YYYY\",\"web_description\":\"Please enter a date mm/dd/yyyy.\",\"common\":true,\"disabled\":false,\"date_time_field_order\":1,\"text_field_order\":null,\"web_locale_key\":\"SERVER_VALIDATION.FIELDS.DATE_US\"},\"formula_calculation\":\"1\"}],\"hyperlinks\":[],\"inserts\":[],\"notary_invites\":[],\"payments\":[],\"radiobuttons\":[],\"seals\":[],\"requests\":[],\"lines\":[],\"general_expiration_days\":30,\"general_reminder\":{\"remind_after\":1,\"remind_before\":5,\"remind_repeat\":3},\"order_type\":\"recipient_order\"}", "headers": { "Content-Type": "application/json" } } -} +} \ No newline at end of file diff --git a/src/test/resources/wiremock/mappings/get_document_group_get.json b/src/test/resources/wiremock/mappings/get_document_group_get.json index b24f633..5fde921 100644 --- a/src/test/resources/wiremock/mappings/get_document_group_get.json +++ b/src/test/resources/wiremock/mappings/get_document_group_get.json @@ -5,9 +5,9 @@ }, "response": { "status": 200, - "body": "{\"id\":\"7a694acfac7ea6e017d990f4bb62f54a7e858aa5\",\"group_name\":\"sunt\",\"documents\":[{\"id\":\"2a1b1970eff34e70759b554e7fd8c1df26335d9a\",\"roles\":[\"quia\"],\"document_name\":\"facilis sit\",\"thumbnail\":{\"small\":\"https:\\/\\/api.signnow.com\\/document\\/3fddb3bb127ba3958bf4ee546502b36fe1e2b88d\\/thumbnail?size=small\",\"medium\":\"https:\\/\\/api.signnow.com\\/document\\/3fddb3bb127ba3958bf4ee546502b36fe1e2b88d\\/thumbnail?size=medium\",\"large\":\"https:\\/\\/api.signnow.com\\/document\\/3fddb3bb127ba3958bf4ee546502b36fe1e2b88d\\/thumbnail?size=large\"},\"origin_document_id\":\"6c5b2d117e1a9571d0e83a944fb90e78c91e4af4\",\"has_unassigned_field\":false,\"has_credit_card_number\":false,\"allowed_to_remove\":false}],\"originator_organization_settings\":[{\"setting\":\"distinctio\",\"value\":\"voluptatum\"}]}", + "body": "{\"id\":\"7a694acfac7ea6e017d990f4bb62f54a7e858aa5\",\"group_name\":\"sunt\",\"documents\":[{\"id\":\"2a1b1970eff34e70759b554e7fd8c1df26335d9a\",\"roles\":[\"quia\"],\"document_name\":\"facilis sit\",\"thumbnail\":{\"small\":\"https://api.signnow.com/document/3fddb3bb127ba3958bf4ee546502b36fe1e2b88d/thumbnail?size=small\",\"medium\":\"https://api.signnow.com/document/3fddb3bb127ba3958bf4ee546502b36fe1e2b88d/thumbnail?size=medium\",\"large\":\"https://api.signnow.com/document/3fddb3bb127ba3958bf4ee546502b36fe1e2b88d/thumbnail?size=large\"},\"origin_document_id\":\"6c5b2d117e1a9571d0e83a944fb90e78c91e4af4\",\"has_unassigned_field\":false,\"has_credit_card_number\":false,\"allowed_to_remove\":false}],\"originator_organization_settings\":[{\"setting\":\"distinctio\",\"value\":\"voluptatum\"}],\"general_expiration_days\":30,\"general_reminder\":{\"remind_after\":1,\"remind_before\":5,\"remind_repeat\":3},\"order_type\":\"recipient_order\"}", "headers": { "Content-Type": "application/json" } } -} +} \ No newline at end of file diff --git a/src/test/resources/wiremock/mappings/get_document_group_recipients_get.json b/src/test/resources/wiremock/mappings/get_document_group_recipients_get.json index b6d988d..4010351 100644 --- a/src/test/resources/wiremock/mappings/get_document_group_recipients_get.json +++ b/src/test/resources/wiremock/mappings/get_document_group_recipients_get.json @@ -5,9 +5,9 @@ }, "response": { "status": 200, - "body": "{\"data\":{\"recipients\":[{\"name\":\"tempora\",\"email\":\"zaria97@turcotte.com\",\"email_group\":{\"id\":\"3828ce352e5e30a253e04d01471b34ab71343b3a\"},\"order\":96973,\"attributes\":{\"message\":\"deserunt\",\"subject\":\"nulla\",\"expiration_days\":47273,\"reminder\":{\"remind_after\":68981,\"remind_before\":41067,\"remind_repeat\":23105},\"allow_forwarding\":true,\"show_decline_button\":true,\"i_am_recipient\":true,\"authentication\":{\"type\":\"expedita\",\"value\":\"quis\",\"phone\":\"enim\",\"method\":\"neque\"}},\"documents\":[{\"id\":\"48fd037fcca265f11f24c3fa0d3c4f242682dd03\",\"role\":\"quibusdam\",\"action\":\"nobis\"}]}],\"unmapped_documents\":[{\"id\":\"71a24daccfc516fa1f8fa7409cb4cfdbb207a339\",\"role\":\"aut\",\"action\":\"dolorem\"}],\"allowed_unmapped_sign_documents\":[{\"id\":\"9a7168ccd8edeac2d7ae4dbdce455c583cd29918\",\"role\":\"aperiam\",\"recipient\":\"placeat\"}],\"cc\":[\"dolor\"]}}", + "body": "{\"data\":{\"recipients\":[{\"name\":\"tempora\",\"email\":\"zaria97@turcotte.com\",\"email_group\":{\"id\":\"3828ce352e5e30a253e04d01471b34ab71343b3a\"},\"order\":96973,\"attributes\":{\"message\":\"deserunt\",\"subject\":\"nulla\",\"expiration_days\":47273,\"reminder\":{\"remind_after\":68981,\"remind_before\":41067,\"remind_repeat\":23105},\"allow_forwarding\":true,\"show_decline_button\":true,\"i_am_recipient\":true,\"authentication\":{\"type\":\"expedita\",\"value\":\"quis\",\"phone\":\"enim\",\"method\":\"neque\"}},\"documents\":[{\"id\":\"48fd037fcca265f11f24c3fa0d3c4f242682dd03\",\"role\":\"quibusdam\",\"action\":\"nobis\"}]}],\"unmapped_documents\":[{\"id\":\"71a24daccfc516fa1f8fa7409cb4cfdbb207a339\",\"role\":\"aut\",\"action\":\"dolorem\"}],\"allowed_unmapped_sign_documents\":[{\"id\":\"9a7168ccd8edeac2d7ae4dbdce455c583cd29918\",\"role\":\"aperiam\",\"recipient\":\"placeat\"}],\"cc\":[\"dolor\"],\"general_expiration_days\":30,\"general_reminder\":{\"remind_after\":1,\"remind_before\":5,\"remind_repeat\":3},\"order_type\":\"recipient_order\"}}", "headers": { "Content-Type": "application/json" } } -} +} \ No newline at end of file diff --git a/src/test/resources/wiremock/mappings/get_document_group_template_recipients_get.json b/src/test/resources/wiremock/mappings/get_document_group_template_recipients_get.json new file mode 100644 index 0000000..97571ee --- /dev/null +++ b/src/test/resources/wiremock/mappings/get_document_group_template_recipients_get.json @@ -0,0 +1,13 @@ +{ + "request": { + "method": "GET", + "urlPathPattern": "/v2/document-group-templates/[0-9a-z]{40}/recipients" + }, + "response": { + "status": 200, + "body": "{\"data\":{\"recipients\":[{\"name\":\"tempora\",\"email\":\"zaria97@turcotte.com\",\"email_group\":{\"id\":\"3828ce352e5e30a253e04d01471b34ab71343b3a\"},\"order\":96973,\"attributes\":{\"message\":\"deserunt\",\"subject\":\"nulla\",\"expiration_days\":47273,\"reminder\":{\"remind_after\":68981,\"remind_before\":41067,\"remind_repeat\":23105},\"allow_forwarding\":true,\"show_decline_button\":true,\"i_am_recipient\":true,\"authentication\":{\"type\":\"expedita\",\"value\":\"quis\",\"phone\":\"enim\",\"method\":\"neque\"}},\"documents\":[{\"id\":\"48fd037fcca265f11f24c3fa0d3c4f242682dd03\",\"role\":\"quibusdam\",\"action\":\"nobis\"}]}],\"unmapped_documents\":[{\"id\":\"71a24daccfc516fa1f8fa7409cb4cfdbb207a339\",\"role\":\"aut\",\"action\":\"dolorem\"}],\"allowed_unmapped_sign_documents\":[{\"id\":\"9a7168ccd8edeac2d7ae4dbdce455c583cd29918\",\"role\":\"aperiam\",\"recipient\":\"placeat\"}],\"cc\":[\"dolor\"],\"general_expiration_days\":30,\"general_reminder\":{\"remind_after\":1,\"remind_before\":5,\"remind_repeat\":3},\"order_type\":\"recipient_order\"}}", + "headers": { + "Content-Type": "application/json" + } + } +} \ No newline at end of file diff --git a/src/test/resources/wiremock/mappings/get_user_info_get.json b/src/test/resources/wiremock/mappings/get_user_info_get.json index 81385ff..720d6b8 100644 --- a/src/test/resources/wiremock/mappings/get_user_info_get.json +++ b/src/test/resources/wiremock/mappings/get_user_info_get.json @@ -5,9 +5,9 @@ }, "response": { "status": 200, - "body": "{\"id\":\"4faadeec87b62ceda16837ce9e466868b2711b39\",\"first_name\":\"Darian\",\"last_name\":\"Stroman\",\"active\":\"0\",\"verified\":\"1\",\"type\":19649,\"pro\":21124,\"created\":\"1226800503\",\"emails\":[\"stroman.darian@yahoo.com\"],\"primary_email\":\"abbey.bode@gmail.com\",\"subscriptions\":[{\"id\":\"2a2a5f82b5ea60b485d515867d4078de1939d7c6\",\"subscription_id\":\"f0bee4b9356384b424736a1109d560bc92aeb4a4\",\"name\":\"corrupti\",\"expired\":370086475,\"created\":1264132721,\"updated\":132080144,\"plan\":\"sunt\",\"mobile_plan_type\":\"tempore\",\"credit_card\":true,\"trial\":false,\"term\":33278,\"seat_admin_email\":\"beatty.chadrick@yahoo.com\",\"plan_version\":28245,\"is_usage_based\":false,\"is_usage_based_seat_free\":true,\"seats\":5,\"used_seats\":2,\"gateway_subscription\":{\"gateway\":\"voluptatem\",\"auto_renew\":true}}],\"credits\":22415,\"has_atticus_access\":true,\"is_logged_in\":false,\"billing_period\":{\"start_date\":\"01/29/1972\",\"end_date\":\"04/04/2001\",\"start_timestamp\":1525243576,\"end_timestamp\":752424642},\"premium_access\":{\"error\":true,\"user\":{\"username\":\"hammes.mateo\",\"email\":\"nienow.elisa@yahoo.com\",\"first_name\":\"doloribus\",\"last_name\":\"fugit\",\"added_date\":87496,\"status\":\"aliquid\",\"admin\":\"deserunt\"},\"active\":true,\"subscription\":{\"serial_number\":\"eaque\",\"name\":\"officia\",\"term\":11016,\"seats\":1179,\"used_seats\":88733,\"expired_at\":45669,\"created_at\":12837,\"updated_at\":54334,\"key\":\"est\",\"version\":\"totam\",\"plan\":{\"id\":3018,\"plan_id\":\"6bab7b9f82e76df965186bac2148814d00d8a635\",\"name\":\"ut\",\"price\":\"odio\",\"billing_cycle\":65798,\"active\":false,\"groups\":[\"eaque\"],\"level\":\"aut\",\"type\":\"ullam\",\"api_requests\":85409,\"unit_price\":43982,\"is_trial\":false,\"is_marketplace\":true},\"admin_email\":\"harmon25@yahoo.com\",\"status\":\"quisquam\",\"trial_period\":0,\"marketplace\":{\"name\":\"fuga\"},\"gateway_subscription\":{\"gateway\":\"officia\",\"auto_renew\":false}},\"plan\":\"aliquid\",\"business\":false,\"trial\":true,\"credit_card\":false,\"api\":{\"key\":\"62185c599634ebbbf6973955de082d3361e9773e\",\"created_at\":472366876,\"expired_at\":113542477,\"level\":\"laudantium\"}},\"companies\":[{\"name\":\"amet\",\"full_access\":false}],\"document_count\":82609,\"monthly_document_count\":53688,\"lifetime_document_count\":1293457407,\"teams\":[{\"id\":\"ee4f2ed08afbb776561a1b4873096894c0e09d85\",\"team\":\"voluptas\",\"type\":\"magnam\",\"created_since\":\"1460887506\",\"role\":\"nobis\",\"document_count\":62506,\"workspace_id\":\"5268631f02595f3c6f68e42b2bd26c71e8989c57\",\"admins\":[{\"id\":\"239ae24e61001e1088eec1b564e6affddc0b6ff8\",\"is_secondary\":\"et\",\"email\":\"shea27@kuhic.com\",\"billing\":49309,\"document_access\":44797,\"primary\":true}]}],\"googleapps\":false,\"facebookapps\":false,\"microsoftapps\":true,\"status\":{\"bad_copy_token\":true,\"has_copy_token\":false,\"has_cloud_export_token\":false,\"bad_cloud_export_token\":true,\"has_salesforce_token\":false},\"settings\":{\"no_document_attachment\":true,\"copy_export\":true,\"no_document_file_attachments\":true,\"no_user_signature_return\":true,\"mobileweb_option\":true,\"require_drawn_signatures\":false,\"org_allowed_team_admins\":false,\"cloud_auto_export\":true,\"digitally_sign_dowloaded_docs\":false,\"invite_completion_redirect_url\":false,\"invite_decline_redirect_url\":false,\"add_signature_stamp\":true,\"pending_invite_document_view_notification\":false,\"signing_link_document_download\":true,\"required_preset_signature_name\":false,\"cloud_export_with_history\":false,\"emailed_docs_include_history\":true,\"document_completion_retention_days\":false,\"enable_hyperlink_protection\":false,\"enable_advanced_threat_protection\":true,\"require_login_for_signing\":false,\"logout_on_signing\":false,\"audit_trail_completion_retention_days\":false,\"front_end_session_length\":false,\"email_admin_on_banned_login\":true,\"add_signature_stamp_with_name\":false,\"cfr_title_21_part_11\":false,\"unsuccessful_logout_attempts_allowed\":true,\"require_authentication_for_invites\":true,\"electronic_consent_required\":true,\"electronic_consent_text\":true,\"document_guide\":false,\"watermark_downloaded_document\":true,\"restrict_download\":false,\"disable_email_notifications\":false,\"upload_limit\":true,\"document_schema_extended\":true,\"invite_update_notifications_for_all_invites_at_invite_create\":false,\"enable_full_story_tracker\":true,\"document_attachment_only_for_signer\":false,\"sso-only-login\":false,\"block_export_options_when_credit_card_validation_is_used\":false,\"only_administrator_is_able_to_invite_to_the_team\":true,\"block_login_via_social_networks\":true,\"redirect_to_registration_when_fields_saved\":false,\"common_experiments\":false,\"hide_decline_to_sign_option_in_signing_session\":true,\"hide_upgrade_subscription_button\":false,\"do_no_consent_redirect_url\":false,\"lock_signing_date_by_default\":true,\"allow_download_certificate\":true,\"have_merged_document_group_option\":false,\"enable_eu_date_format\":false,\"guide_signers_only_through_required_fields\":false,\"allow_document_copying_to_other_accounts\":true,\"email_custom_subject\":true,\"email_custom_message\":false,\"invite_expiration_days\":true,\"enable_mfa\":false,\"enable_document_download_link_for_invite_completion_mails\":false,\"allow_big_attachment_file\":true,\"allow_big_count_of_attachment_fields_per_document\":true,\"enable_hyperlink_field\":true,\"disable_download_action_in_editor\":true,\"signature_stamp_position\":false,\"enable_pki\":true,\"enable_document_comments\":true,\"cc_completion_email_contain_only_downloading_document_link\":false,\"save_signer_signature_and_initials\":true,\"auto_apply_signatures_and_initials_to_document_fields\":true,\"block_organization_selfleave_by_member\":false,\"receive_signer_email_after_sent_field_invite_to_yourself\":false,\"date_format\":false,\"completed_document_name_formula\":true,\"agreement_to_test_new_functionality_in_organization\":false,\"agree_to_be_beta_tester\":true,\"default_field_invite_remind_before\":false,\"default_field_invite_remind_after\":false,\"default_field_invite_remind_repeat\":false,\"default_field_invite_expiration_time\":true,\"email_logo_position\":false,\"email_btn_bkgd_color\":true,\"email_btn_text_color\":true,\"allow_edit_document_after_signing\":false,\"allow_embedded_extended_token_expiration\":true,\"every_signature_and_initials_field_requires_user_authentication\":false,\"enable_render_pages_in_editor_as_images\":false,\"enable_team_admin_move_docs\":false,\"disable_email_recipients\":true,\"allow_team_admin_rename_docs\":true,\"email_footer_enabled\":true,\"parse_only_signature_fields\":false,\"flatten_before_aspose\":true,\"run_experiments\":true,\"disable_form_search\":false,\"allow_team_admin_create_csv_report_for_shared_template\":false,\"enable_team_generic_email\":false,\"use_team_generic_data\":true,\"signing_reason\":true,\"allow_qes\":false,\"enable_qes\":false,\"advanced_signing_flow\":true,\"document_prefill_disable_fields_existing_validation\":true,\"disable_problem_invite_email_notifications\":false,\"default_workspace_assigned\":true,\"workspace_organization\":true,\"default_workspace\":false,\"workspace_subscription_admin\":false},\"organization_settings\":[{\"setting\":\"minus\",\"value\":\"nihil\"}],\"issue_notifications\":[{\"title\":\"aut\",\"description\":\"sint\"}],\"merchant_accounts\":[{\"id\":\"b9748a54e3ef4ecc7b7743e979e2432ea285d397\",\"scope\":\"voluptatem\",\"merchant_type\":\"et\",\"merchant_account_name\":\"consequatur\",\"currencies\":[\"suscipit\"],\"currency\":\"NPR\",\"currency_name\":\"enim\"}]}", + "body": "{\"id\":\"4faadeec87b62ceda16837ce9e466868b2711b39\",\"first_name\":\"Darian\",\"last_name\":\"Stroman\",\"active\":\"0\",\"verified\":\"1\",\"type\":19649,\"pro\":21124,\"created\":\"1226800503\",\"emails\":[\"stroman.darian@yahoo.com\"],\"primary_email\":\"abbey.bode@gmail.com\",\"subscriptions\":[{\"id\":\"2a2a5f82b5ea60b485d515867d4078de1939d7c6\",\"subscription_id\":\"f0bee4b9356384b424736a1109d560bc92aeb4a4\",\"name\":\"corrupti\",\"expired\":370086475,\"created\":1264132721,\"updated\":132080144,\"plan\":\"sunt\",\"mobile_plan_type\":\"tempore\",\"credit_card\":true,\"trial\":false,\"term\":33278,\"seat_admin_email\":\"beatty.chadrick@yahoo.com\",\"plan_version\":28245,\"is_usage_based\":false,\"is_usage_based_seat_free\":true,\"seats\":5,\"used_seats\":2,\"gateway_subscription\":{\"gateway\":\"voluptatem\",\"auto_renew\":true}}],\"credits\":22415,\"has_atticus_access\":true,\"is_logged_in\":false,\"billing_period\":{\"start_date\":\"01/29/1972\",\"end_date\":\"04/04/2001\",\"start_timestamp\":1525243576,\"end_timestamp\":752424642},\"premium_access\":{\"error\":true,\"user\":{\"username\":\"hammes.mateo\",\"email\":\"nienow.elisa@yahoo.com\",\"first_name\":\"doloribus\",\"last_name\":\"fugit\",\"added_date\":87496,\"status\":\"aliquid\",\"admin\":\"deserunt\"},\"active\":true,\"subscription\":{\"serial_number\":\"eaque\",\"name\":\"officia\",\"term\":11016,\"seats\":1179,\"used_seats\":88733,\"expired_at\":45669,\"created_at\":12837,\"updated_at\":54334,\"key\":\"est\",\"version\":\"totam\",\"plan\":{\"id\":3018,\"plan_id\":\"6bab7b9f82e76df965186bac2148814d00d8a635\",\"name\":\"ut\",\"price\":\"odio\",\"billing_cycle\":65798,\"active\":false,\"groups\":[\"eaque\"],\"level\":\"aut\",\"type\":\"ullam\",\"api_requests\":85409,\"unit_price\":43982,\"is_trial\":false,\"is_marketplace\":true,\"mobile_plan_type\":null},\"admin_email\":\"harmon25@yahoo.com\",\"status\":\"quisquam\",\"trial_period\":0,\"marketplace\":{\"name\":\"fuga\"},\"gateway_subscription\":{\"gateway\":\"officia\",\"auto_renew\":false}},\"plan\":\"aliquid\",\"business\":false,\"trial\":true,\"credit_card\":false,\"api\":{\"key\":\"62185c599634ebbbf6973955de082d3361e9773e\",\"created_at\":472366876,\"expired_at\":113542477,\"level\":\"laudantium\"}},\"companies\":[{\"name\":\"amet\",\"full_access\":false}],\"document_count\":82609,\"monthly_document_count\":53688,\"lifetime_document_count\":1293457407,\"teams\":[{\"id\":\"ee4f2ed08afbb776561a1b4873096894c0e09d85\",\"team\":\"voluptas\",\"type\":\"magnam\",\"created_since\":\"1460887506\",\"role\":\"nobis\",\"document_count\":62506,\"workspace_id\":\"5268631f02595f3c6f68e42b2bd26c71e8989c57\",\"admins\":[{\"id\":\"239ae24e61001e1088eec1b564e6affddc0b6ff8\",\"is_secondary\":\"et\",\"email\":\"shea27@kuhic.com\",\"billing\":49309,\"document_access\":44797,\"primary\":true}]}],\"googleapps\":false,\"facebookapps\":false,\"microsoftapps\":true,\"status\":{\"bad_copy_token\":true,\"has_copy_token\":false,\"has_cloud_export_token\":false,\"bad_cloud_export_token\":true,\"has_salesforce_token\":false},\"settings\":{\"no_document_attachment\":true,\"copy_export\":true,\"no_document_file_attachments\":true,\"no_user_signature_return\":true,\"mobileweb_option\":true,\"require_drawn_signatures\":false,\"org_allowed_team_admins\":false,\"cloud_auto_export\":true,\"digitally_sign_dowloaded_docs\":false,\"invite_completion_redirect_url\":false,\"invite_decline_redirect_url\":false,\"add_signature_stamp\":true,\"pending_invite_document_view_notification\":false,\"signing_link_document_download\":true,\"required_preset_signature_name\":false,\"cloud_export_with_history\":false,\"emailed_docs_include_history\":true,\"document_completion_retention_days\":false,\"enable_hyperlink_protection\":false,\"enable_advanced_threat_protection\":true,\"require_login_for_signing\":false,\"logout_on_signing\":false,\"audit_trail_completion_retention_days\":false,\"front_end_session_length\":false,\"email_admin_on_banned_login\":true,\"add_signature_stamp_with_name\":false,\"cfr_title_21_part_11\":false,\"unsuccessful_logout_attempts_allowed\":true,\"require_authentication_for_invites\":true,\"electronic_consent_required\":true,\"electronic_consent_text\":true,\"document_guide\":false,\"watermark_downloaded_document\":true,\"restrict_download\":false,\"disable_email_notifications\":false,\"upload_limit\":true,\"document_schema_extended\":true,\"invite_update_notifications_for_all_invites_at_invite_create\":false,\"enable_full_story_tracker\":true,\"document_attachment_only_for_signer\":false,\"sso-only-login\":false,\"block_export_options_when_credit_card_validation_is_used\":false,\"only_administrator_is_able_to_invite_to_the_team\":true,\"block_login_via_social_networks\":true,\"redirect_to_registration_when_fields_saved\":false,\"common_experiments\":false,\"hide_decline_to_sign_option_in_signing_session\":true,\"hide_upgrade_subscription_button\":false,\"do_no_consent_redirect_url\":false,\"lock_signing_date_by_default\":true,\"allow_download_certificate\":true,\"have_merged_document_group_option\":false,\"enable_eu_date_format\":false,\"guide_signers_only_through_required_fields\":false,\"allow_document_copying_to_other_accounts\":true,\"email_custom_subject\":true,\"email_custom_message\":false,\"invite_expiration_days\":true,\"enable_mfa\":false,\"enable_document_download_link_for_invite_completion_mails\":false,\"allow_big_attachment_file\":true,\"allow_big_count_of_attachment_fields_per_document\":true,\"enable_hyperlink_field\":true,\"disable_download_action_in_editor\":true,\"signature_stamp_position\":false,\"enable_pki\":true,\"enable_document_comments\":true,\"cc_completion_email_contain_only_downloading_document_link\":false,\"save_signer_signature_and_initials\":true,\"auto_apply_signatures_and_initials_to_document_fields\":true,\"block_organization_selfleave_by_member\":false,\"receive_signer_email_after_sent_field_invite_to_yourself\":false,\"date_format\":false,\"completed_document_name_formula\":true,\"agreement_to_test_new_functionality_in_organization\":false,\"agree_to_be_beta_tester\":true,\"default_field_invite_remind_before\":false,\"default_field_invite_remind_after\":false,\"default_field_invite_remind_repeat\":false,\"default_field_invite_expiration_time\":true,\"email_logo_position\":false,\"email_btn_bkgd_color\":true,\"email_btn_text_color\":true,\"allow_edit_document_after_signing\":false,\"allow_embedded_extended_token_expiration\":true,\"every_signature_and_initials_field_requires_user_authentication\":false,\"enable_render_pages_in_editor_as_images\":false,\"enable_team_admin_move_docs\":false,\"disable_email_recipients\":true,\"allow_team_admin_rename_docs\":true,\"email_footer_enabled\":true,\"parse_only_signature_fields\":false,\"flatten_before_aspose\":true,\"run_experiments\":true,\"disable_form_search\":false,\"allow_team_admin_create_csv_report_for_shared_template\":false,\"enable_team_generic_email\":false,\"use_team_generic_data\":true,\"signing_reason\":true,\"allow_qes\":false,\"enable_qes\":false,\"advanced_signing_flow\":true,\"document_prefill_disable_fields_existing_validation\":true,\"disable_problem_invite_email_notifications\":false,\"default_workspace_assigned\":true,\"workspace_organization\":true,\"default_workspace\":false,\"workspace_subscription_admin\":false},\"organization_settings\":[{\"setting\":\"minus\",\"value\":\"nihil\"}],\"issue_notifications\":[{\"title\":\"aut\",\"description\":\"sint\"}],\"merchant_accounts\":[{\"id\":\"b9748a54e3ef4ecc7b7743e979e2432ea285d397\",\"scope\":\"voluptatem\",\"merchant_type\":\"et\",\"merchant_account_name\":\"consequatur\",\"currencies\":[\"suscipit\"],\"currency\":\"NPR\",\"currency_name\":\"enim\"}]}", "headers": { "Content-Type": "application/json" } } -} +} \ No newline at end of file diff --git a/src/test/resources/wiremock/mappings/update_document_group_recipients_put.json b/src/test/resources/wiremock/mappings/update_document_group_recipients_put.json index b7b2925..c17f57f 100644 --- a/src/test/resources/wiremock/mappings/update_document_group_recipients_put.json +++ b/src/test/resources/wiremock/mappings/update_document_group_recipients_put.json @@ -5,9 +5,9 @@ }, "response": { "status": 200, - "body": "{\"data\":{\"recipients\":[{\"name\":\"molestiae\",\"email\":\"udaugherty@gmail.com\",\"email_group\":{\"id\":\"02c9bc5e05f7e83897b324bba9f6665a4b9b671e\"},\"order\":86425,\"attributes\":{\"message\":\"qui\",\"subject\":\"nihil\",\"expiration_days\":8556,\"reminder\":{\"remind_after\":95281,\"remind_before\":6116,\"remind_repeat\":91025},\"allow_forwarding\":false,\"show_decline_button\":true,\"i_am_recipient\":true,\"authentication\":{\"type\":\"consequatur\",\"value\":\"vel\",\"phone\":\"voluptas\",\"method\":\"explicabo\"}},\"documents\":[{\"id\":\"b667c03e2551fead0d0f2af5d6aeb681058cf5a2\",\"role\":\"fuga\",\"action\":\"in\"}]}],\"unmapped_documents\":[{\"id\":\"f03e83b3f3aa56e94f7a658eb1c3b9fde7959881\",\"role\":\"maiores\",\"action\":\"dolorem\"}],\"allowed_unmapped_sign_documents\":[{\"id\":\"f7872e68c3079f03bcc12f1f284def5cdb566d26\",\"role\":\"labore\",\"recipient\":\"quaerat\"}],\"cc\":[\"omnis\"]}}", + "body": "{\"data\":{\"recipients\":[{\"name\":\"molestiae\",\"email\":\"udaugherty@gmail.com\",\"email_group\":{\"id\":\"02c9bc5e05f7e83897b324bba9f6665a4b9b671e\"},\"order\":86425,\"attributes\":{\"message\":\"qui\",\"subject\":\"nihil\",\"expiration_days\":8556,\"reminder\":{\"remind_after\":95281,\"remind_before\":6116,\"remind_repeat\":91025},\"allow_forwarding\":false,\"show_decline_button\":true,\"i_am_recipient\":true,\"authentication\":{\"type\":\"consequatur\",\"value\":\"vel\",\"phone\":\"voluptas\",\"method\":\"explicabo\"}},\"documents\":[{\"id\":\"b667c03e2551fead0d0f2af5d6aeb681058cf5a2\",\"role\":\"fuga\",\"action\":\"in\"}]}],\"unmapped_documents\":[{\"id\":\"f03e83b3f3aa56e94f7a658eb1c3b9fde7959881\",\"role\":\"maiores\",\"action\":\"dolorem\"}],\"allowed_unmapped_sign_documents\":[{\"id\":\"f7872e68c3079f03bcc12f1f284def5cdb566d26\",\"role\":\"labore\",\"recipient\":\"quaerat\"}],\"cc\":[\"omnis\"],\"general_expiration_days\":30,\"general_reminder\":{\"remind_after\":1,\"remind_before\":5,\"remind_repeat\":3},\"order_type\":\"recipient_order\"}}", "headers": { "Content-Type": "application/json" } } -} +} \ No newline at end of file diff --git a/src/test/resources/wiremock/mappings/update_document_group_template_recipients_put.json b/src/test/resources/wiremock/mappings/update_document_group_template_recipients_put.json new file mode 100644 index 0000000..2a7105f --- /dev/null +++ b/src/test/resources/wiremock/mappings/update_document_group_template_recipients_put.json @@ -0,0 +1,13 @@ +{ + "request": { + "method": "PUT", + "urlPathPattern": "/v2/document-group-templates/[0-9a-z]{40}/recipients" + }, + "response": { + "status": 200, + "body": "{\"data\":{\"recipients\":[{\"name\":\"molestiae\",\"email\":\"udaugherty@gmail.com\",\"email_group\":{\"id\":\"02c9bc5e05f7e83897b324bba9f6665a4b9b671e\"},\"order\":86425,\"attributes\":{\"message\":\"qui\",\"subject\":\"nihil\",\"expiration_days\":8556,\"reminder\":{\"remind_after\":95281,\"remind_before\":6116,\"remind_repeat\":91025},\"allow_forwarding\":false,\"show_decline_button\":true,\"i_am_recipient\":true,\"authentication\":{\"type\":\"consequatur\",\"value\":\"vel\",\"phone\":\"voluptas\",\"method\":\"explicabo\"}},\"documents\":[{\"id\":\"b667c03e2551fead0d0f2af5d6aeb681058cf5a2\",\"role\":\"fuga\",\"action\":\"in\"}]}],\"unmapped_documents\":[{\"id\":\"f03e83b3f3aa56e94f7a658eb1c3b9fde7959881\",\"role\":\"maiores\",\"action\":\"dolorem\"}],\"allowed_unmapped_sign_documents\":[{\"id\":\"f7872e68c3079f03bcc12f1f284def5cdb566d26\",\"role\":\"labore\",\"recipient\":\"quaerat\"}],\"cc\":[\"omnis\"],\"general_expiration_days\":30,\"general_reminder\":{\"remind_after\":1,\"remind_before\":5,\"remind_repeat\":3},\"order_type\":\"recipient_order\"}}", + "headers": { + "Content-Type": "application/json" + } + } +} \ No newline at end of file