Skip to content

PDFCLOUD-5549 Add Blank PDF client methods#14

Merged
datalogics-kam merged 8 commits intopdfrest:mainfrom
datalogics-cgreen:pdfcloud-5464-blank-pdf
Feb 17, 2026
Merged

PDFCLOUD-5549 Add Blank PDF client methods#14
datalogics-kam merged 8 commits intopdfrest:mainfrom
datalogics-cgreen:pdfcloud-5464-blank-pdf

Conversation

@datalogics-cgreen
Copy link
Copy Markdown
Contributor

@datalogics-cgreen datalogics-cgreen commented Jan 20, 2026

Adds Blank PDF client support (sync + async) with validated payloads and response normalization for blank-pdf output-only responses.

  • New blank_pdf() helpers on PdfRestClient and AsyncPdfRestClient.
  • New PdfBlankPayload model with page-size/orientation/custom-dimension validation.
  • Response handling now falls back to output IDs when input IDs are absent.
  • Public PdfPageSize and PdfPageOrientation literals exported via pdfrest.types.
  • Unit tests and live tests covering success, customization, and invalid input paths.

@datalogics-gwalczak datalogics-gwalczak changed the title Pdfcloud 5464 blank pdf PDFCLOUD-5464 blank pdf Jan 21, 2026
@datalogics-cgreen datalogics-cgreen changed the title PDFCLOUD-5464 blank pdf PDFCLOUD-5549 Add Blank PDF client methods Jan 30, 2026
@datalogics-cgreen datalogics-cgreen force-pushed the pdfcloud-5464-blank-pdf branch 2 times, most recently from 32c7f04 to 7c6dcbb Compare February 9, 2026 16:05
@datalogics-cgreen datalogics-cgreen marked this pull request as ready for review February 9, 2026 16:05
@datalogics-cgreen datalogics-cgreen marked this pull request as draft February 10, 2026 17:52
@datalogics-cgreen datalogics-cgreen marked this pull request as ready for review February 10, 2026 22:04
@datalogics-kam
Copy link
Copy Markdown
Contributor

Looks like this needs a rebase, Chris.

Copy link
Copy Markdown
Contributor

@datalogics-kam datalogics-kam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass...please remove code that violates SOLID, and make the suggested change to make endpoints work that don't have input_id.

Comment thread src/pdfrest/client.py Outdated
Comment thread src/pdfrest/models/_internal.py
Comment thread src/pdfrest/client.py Outdated
@datalogics-cgreen datalogics-cgreen marked this pull request as draft February 11, 2026 23:31
@datalogics-cgreen datalogics-cgreen force-pushed the pdfcloud-5464-blank-pdf branch 2 times, most recently from 327d68a to 66d0c33 Compare February 11, 2026 23:50
Copy link
Copy Markdown
Contributor

@datalogics-kam datalogics-kam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still an incorrect handling of empty input ids.

Comment thread src/pdfrest/client.py Outdated
Comment thread src/pdfrest/client.py Outdated
@datalogics-cgreen datalogics-cgreen marked this pull request as ready for review February 12, 2026 19:47
Copy link
Copy Markdown
Contributor

@datalogics-kam datalogics-kam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asking for

  • Less complicated interface for page sizes
  • Defaults surfaced.

Comment thread src/pdfrest/client.py Outdated
Comment thread src/pdfrest/client.py Outdated
Comment thread src/pdfrest/client.py
Comment thread src/pdfrest/models/_internal.py
Comment thread src/pdfrest/models/_internal.py
@datalogics-cgreen
Copy link
Copy Markdown
Contributor Author

/blank-pdf has no default values, save for output.

I can absolutely set sensible default values here; they just wouldn't reflect expectations from the server.

@datalogics-kam
Copy link
Copy Markdown
Contributor

I can absolutely set sensible default values here; they just wouldn't reflect expectations from the server.

I think per our recent discussions, the server does something for the values if they're not specified, and that something should be the default at the client.py level. It makes the interface clearer and easier to use.

Copy link
Copy Markdown
Contributor

@datalogics-kam datalogics-kam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Use TypedDict instead of tuple for custom page size. It's clearer, and types like TypedDict are designed to make names/keys obvious. (There's also NamedTuple, but we haven't used that yet, and let's not start at this moment.)
  • Please surface defaults for orientation and page count all the way to the public interface, also the page size.
  • Codex PR Reviewer had no findings.

Comment thread src/pdfrest/types/public.py Outdated
Comment thread src/pdfrest/client.py Outdated
Comment thread src/pdfrest/client.py Outdated
Comment thread src/pdfrest/client.py Outdated
- Add `blank_pdf()` sync and async methods
- Ensure compatibility with Blank PDF response:
  - Allow PdfRestRawFileResponse.input_id to default empty so missing inputId doesn’t fail validation
  - When normalizing file responses, fall back to raw ids (outputId) when inputId is absent for blank-pdf
  - Document blank-pdf handling to keep response construction working without server-provided input ids

Assisted-by: Codex
- Add full sync+async unit parametrization for blank_pdf page-size/page-orientation
literals across all standard sizes.
- Add explicit boundary tests for page_count (min/max success and below/above range
validation) and custom dimension validation for non-positive values.

Assisted-by: Codex
- Add a shared literal case matrix to live blank-pdf tests covering all accepted
page_size values, both page_orientation literals, and custom dimensions.
- Keep explicit invalid extra_body overrides for both transports to verify server
errors on unsupported page_size values.

Assisted-by: Codex
Page size can be either a `str` literal or custom dimensions

Assisted-by: Codex
Assisted-by: Codex
@datalogics-kam
Copy link
Copy Markdown
Contributor

This failed the required test coverage for new code. You could probably just copy the diff-cover results form the log and ask Codex to write more testing.

@datalogics-kam
Copy link
Copy Markdown
Contributor

You can also get coverage differences locally by running the tests and looking at the coverage file.

git remote update
uvx nox --python 3.12 --session tests -- -n auto
uv run diff-cover --compare-branch=upstream/main coverage/py3.12/coverage.xml

@datalogics-kam datalogics-kam merged commit 5fc736f into pdfrest:main Feb 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants