Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ dependency-reduced-pom.xml
mem*.db

README.html
/CLAUDE.md
2 changes: 1 addition & 1 deletion client-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.signnow</groupId>
<artifactId>api-client-lib</artifactId>
<version>1.0.6</version>
<version>1.0.7</version>
<packaging>jar</packaging>

<properties>
Expand Down
41 changes: 40 additions & 1 deletion client-lib/src/main/java/com/signnow/library/dto/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Document extends GenericId {
public List<DocumentSignRequestInfo> requests;
@JsonProperty("fields")
public List<FieldMetadata> fields;
public List<Role> roles;

public static class SigningLinkRequest {
@JsonProperty("document_id")
Expand Down Expand Up @@ -225,6 +226,22 @@ public static class FieldInvite extends GenericId {
public String status;
public String email;
public String role;
@JsonProperty("role_id")
public String roleId;
@JsonProperty("is_embedded")
public Boolean isEmbedded;
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static class Role {
@JsonProperty("unique_id")
public String uniqueId;
/**
* SignNow returns this number as a string, same as {@link Document#pageCount}
*/
@JsonProperty("signing_order")
public String signingOrder;
public String name;
}

@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down Expand Up @@ -257,11 +274,33 @@ public static class EmbeddedInvite {
public int order = 1;
@JsonProperty("auth_method")
public String authMethod = "none";

@JsonProperty("first_name")
public String firstName;
@JsonProperty("last_name")
public String lastName;
public String language;

/**
* @param email signer email
* @param role role NAME (e.g. "Signer 1"), not the role id. To create an invite
* by role id use {@link #forRoleId(String, String)}.
*/
public EmbeddedInvite(String email, String role) {
this.email = email;
this.role = role;
}

/**
* Creates an invite addressed by role id (the {@code unique_id} of a {@link Role}).
*
* @param email signer email
* @param roleId role id from {@link Document#roles} ({@link Role#uniqueId})
*/
public static EmbeddedInvite forRoleId(String email, String roleId) {
EmbeddedInvite invite = new EmbeddedInvite(email, null);
invite.role_id = roleId;
return invite;
}
}

public static class EmbeddedSigningInviteResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public interface Documents {

String getDocumentEmbeddedSignInviteLink(String documentId, String inviteId, Document.EmbeddedInviteLinkRequest request) throws SNException;

void deleteDocumentEmbeddedSignInvite(String documentId) throws SNException;

void updateDocumentFields(String documentId, List<Document.Field> request) throws SNException;

void prefillText(String documentId, List<Document.FieldText> request) throws SNException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ public String getDocumentEmbeddedSignInviteLink(String documentId, String invite
return response.getLink();
}

@Override
public void deleteDocumentEmbeddedSignInvite(String documentId) throws SNException {
client.delete(
"/v2/documents/{document_id}/embedded-invites",
Collections.singletonMap("document_id", documentId),
String.class
);
}

@Override
public void prefillText(String documentId, List<Document.FieldText> request) throws SNException {
client.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ void deleteDocument() throws SNException {
verify(clientMock, times(1)).delete(anyString(), anyMap(), any());
}

@Test
void deleteDocumentEmbeddedSignInvite() throws SNException {
when(clientMock.delete(anyString(), anyMap(), any())).thenReturn(null);

service.deleteDocumentEmbeddedSignInvite("1");

verify(clientMock, times(1)).delete(anyString(), anyMap(), any());
Comment thread
VitaliiSkuratovskyi marked this conversation as resolved.
}

@Test
void getDownloadLink() throws SNException {
when(clientMock.post(anyString()
Expand Down