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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = blueink-client-python
version = 1.4.0
version = 1.5.0
author = Blueink
author_email = pypi@blueink.com
description = Python Client for Blueink eSignature API
Expand Down
5 changes: 5 additions & 0 deletions src/blueink/model/bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ class Document(BaseModel):
fields: Optional[List[Field]] = None
auto_placements: Optional[List[AutoPlacement]] = None
html_fields_mode: Optional[str] = None
converted_adobe_fields_to: Optional[str] = None
adobe_field_assignments: Optional[dict] = None

@classmethod
def create(cls, key=None, **kwargs):
Expand Down Expand Up @@ -341,6 +343,9 @@ class Bundle(BaseModel):
expires: Optional[str] = None
allow_signer_reassign: Optional[bool] = None
allow_chained_signer_reassign: Optional[bool] = None
max_reminders: Optional[int] = None
owner_name: Optional[str] = None
owner_email: Optional[str] = None
tag_values: Optional[dict] = None

@classmethod
Expand Down
15 changes: 15 additions & 0 deletions src/blueink/subclients/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,21 @@ def list_files(self, bundle_id: str) -> NormalizedResponse:
url = self.build_url(endpoints.BUNDLES.LIST_FILES, bundle_id=bundle_id)
return self._requests.get(url)

def generate_files(self, bundle_id: str) -> NormalizedResponse:
"""Enqueue unsigned filled-PDF generation for an incomplete Bundle.

Requires early file access (FEATURE.API_DATA_EARLY). Poll list_files
until ready (APIv2 2.19.0+).

Args:
bundle_id: which bundle to generate files for

Returns:
NormalizedResponse object (body includes the Bundle id)
"""
url = self.build_url(endpoints.BUNDLES.LIST_FILES, bundle_id=bundle_id)
return self._requests.put(url)

def list_data(self, bundle_id: str) -> NormalizedResponse:
"""Return a data for the supplied bundle corresponding to the id

Expand Down
29 changes: 28 additions & 1 deletion src/blueink/tests/test_bundle_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from munch import Munch

from blueink.bundle_helper import BundleHelper
from blueink.model.bundles import ImportedDocument
from blueink.model.bundles import Bundle, Document, ImportedDocument
from blueink.utils.testcase import TestCase


Expand Down Expand Up @@ -632,3 +632,30 @@ def test_validation_error_file_url_only(self):
"""Test that providing only file_url raises a ValidationError"""
with pytest.raises(Exception):
ImportedDocument.create(file_url="https://example.com/test.pdf")


class TestApiV219BundleModels(TestCase):
def test_bundle_model_accepts_owner_and_max_reminders(self):
bundle = Bundle(
packets=[],
documents=[],
max_reminders=3,
owner_name="Ada Lovelace",
owner_email="ada@example.com",
)
self.assert_equal(bundle.max_reminders, 3)
self.assert_equal(bundle.owner_name, "Ada Lovelace")
self.assert_equal(bundle.owner_email, "ada@example.com")

def test_bundle_model_accepts_null_max_reminders(self):
bundle = Bundle(packets=[], documents=[], max_reminders=None)
self.assert_equal(bundle.max_reminders, None)

def test_document_model_accepts_adobe_field_assignments(self):
doc = Document(
key="doc-1",
converted_adobe_fields_to="signer-1",
adobe_field_assignments={"Signature1": "signer-1"},
)
self.assert_equal(doc.converted_adobe_fields_to, "signer-1")
self.assert_equal(doc.adobe_field_assignments["Signature1"], "signer-1")
Loading