Skip to content

Commit

Permalink
Fixes how the protocol works
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Feb 29, 2024
1 parent 2832124 commit e4b1024
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/gotenberg_client/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from types import TracebackType
from typing import Dict
from typing import Optional
from typing import Protocol
from typing import Type
from typing import Union

Expand All @@ -28,7 +29,11 @@ class UnreachableCodeError(Exception):
pass


class PdfFormatMixin:
class HasFormData(Protocol):
_form_data: Dict[str, str]


class PdfFormatMixin(HasFormData):
"""
https://gotenberg.dev/docs/routes#pdfa-chromium
https://gotenberg.dev/docs/routes#pdfa-libreoffice
Expand All @@ -39,11 +44,11 @@ def pdf_format(self, pdf_format: PdfAFormat) -> Self:
All routes provide the option to configure the output PDF as a
PDF/A format
"""
self._form_data.update(pdf_format.to_form()) # type: ignore[attr-defined,misc]
self._form_data.update(pdf_format.to_form())
return self


class PfdUniversalAccessMixin:
class PfdUniversalAccessMixin(HasFormData):
"""
https://gotenberg.dev/docs/routes#pdfa-chromium
https://gotenberg.dev/docs/routes#pdfa-libreoffice
Expand All @@ -52,11 +57,11 @@ class PfdUniversalAccessMixin:
"""

def enable_universal_access(self) -> Self:
self._form_data.update({"pdfua": "true"}) # type: ignore[attr-defined,misc]
self._form_data.update({"pdfua": "true"})
return self

def disable_universal_access(self) -> Self:
self._form_data.update({"pdfua": "true"}) # type: ignore[attr-defined,misc]
self._form_data.update({"pdfua": "true"})
return self


Expand Down

0 comments on commit e4b1024

Please sign in to comment.