Skip to content

Commit 6877018

Browse files
authored
Add additional params for EtchSigner, more example documentation (anvilco#16)
1 parent e154d89 commit 6877018

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

examples/create_etch_existing_cast.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,20 @@ def main():
5454
# send emails when this etch packet is created.
5555
# It can also be set to "embedded" which will _not_ send emails, and
5656
# you will need to handle sending the signer URLs manually in some way.
57-
signer_type="embedded",
57+
signer_type="email",
58+
# You can also change how signatures will be collected.
59+
# "draw" will allow the signer to draw their signature
60+
# "text" will insert a text version of the signer's name into the
61+
# signature field.
62+
signature_mode="draw",
63+
# Whether or not to the signer is required to click each signature
64+
# field manually. If `False`, the PDF will be signed once the signer
65+
# accepts the PDF without making the user go through the PDF.
66+
accept_each_field=False,
67+
# URL of where the signer will be redirected after signing.
68+
# The URL will also have certain URL params added on, so the page
69+
# can be customized based on the signing action.
70+
redirect_url="https://www.google.com"
5871
)
5972

6073
# Add your signer.

python_anvil/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def create_etch_packet(
233233
"`payload` must be a valid CreateEtchPacket instance or dict"
234234
)
235235
return self.mutate(
236-
mutation, variables=mutation.create_payload().dict(by_alias=True), **kwargs
236+
mutation, variables=mutation.create_payload().dict(by_alias=True, exclude_none=True), **kwargs
237237
)
238238

239239
def generate_etch_signing_url(self, signer_eid: str, client_user_id: str, **kwargs):

python_anvil/api_resources/payload.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# import `BaseModel` and it's not broken, so let's keep it.
77
from pydantic import ( # pylint: disable=no-name-in-module
88
BaseModel as _BaseModel,
9+
Field,
910
validator,
1011
)
1112
from typing import Any, Dict, List, Literal, Optional, Union
@@ -89,9 +90,15 @@ class EtchSigner(BaseModel):
8990
email: str
9091
fields: List[SignerField]
9192
signer_type: str = "email"
92-
# Will be generated if `None`
93-
id: Optional[str] = ""
93+
# id will be generated if `None`
94+
id: Optional[str] = None
9495
routing_order: Optional[int] = None
96+
redirect_url: Optional[str] = Field(None, alias="redirectURL")
97+
# acceptEachField, signatureMode
98+
accept_each_field: Optional[bool] = None
99+
enable_emails: Optional[List[str]] = None
100+
# signature_mode can be "draw" or "text" (default: text)
101+
signature_mode: Optional[str] = None
95102

96103

97104
class SignatureField(BaseModel):

0 commit comments

Comments
 (0)