Repository navigation
feat: add pdf command to save transactions as QuickBooks-rendered PDFs - #15
Merged
Merged
Conversation
`qbo pdf <entity> <id> [-o path]` fetches GET /{entity}/{id}/pdf with
Accept: application/pdf. The endpoint is reachable through `qbo get`,
but every request there sends Accept: application/json and QuickBooks
answers 500 "No match for accept header".
Supported for invoice, estimate, salesreceipt, creditmemo and
purchaseorder. The id must be numeric (it is interpolated into the
path), and a 200 whose body is not a PDF is refused rather than saved.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019jpxEQMLnxu4s6zSfHq8xR
Compared against a PDF downloaded from the QuickBooks web UI: the API rendering combines invoice lines that share a description into one summed line, where the UI lists them separately. The API returns the same bytes at every minorversion, so it is the renderer, not a request option. Say so instead of claiming it is the customer's document. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019jpxEQMLnxu4s6zSfHq8xR
Owner
|
Thanks for this, and sorry for the wait. A dedicated Please rebase onto current I will handle CI approval on the updated branch. Checks need to pass before merging. |
Owner
|
Thanks for adding this. I merged main into your branch to fix the SKILL.md conflict with the new void command. |
Owner
|
This shipped in v0.8.0: https://github.com/voska/qbo-cli/releases/tag/v0.8.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
qbo pdf <entity> <id> [-o path], which saves a transaction as the PDF the QuickBooks API renders for it.Note: the API rendering is not always identical to what the QuickBooks web UI prints or emails. On a real invoice, the API combined three lines that share a description into one summed line, while the PDF downloaded from the UI lists them separately. The same bytes come back at every
minorversion, so this is QuickBooks' renderer, not a request option. The docs say so.Why
The
/v3/company/{realm}/{entity}/{id}/pdfendpoint is already reachable throughqbo get invoice "123/pdf", but every request the client makes sendsAccept: application/json, and QuickBooks answers500 System Failure Error: No match for accept header. So there was no way to get a PDF out of the CLI.How
api.Client.PDFsendsAccept: application/pdfthrough the same OAuth client as every other call, so it uses the existing token refresh and error mapping (mapHTTPError).invoice,estimate,salesreceipt,creditmemo,purchaseorder. Others are rejected with exit 2.%PDFis refused rather than saved under a.pdfname.--dry-runprints the request and returns before any network call.downloadcommand: hint on stderr,{entity, id, path, bytes}on stdout.skills/qbo/SKILL.mdandreferences/COMMANDS.md.Testing
go test ./...passes. New tests cover the Accept header and path, rejection of a non-PDF 200 body, HTTP error mapping, entity support, input validation, and dry-run without network.qbo pdf invoice <id>returned a 45 KB single-page PDF with the correct header, customer, lines and total (lines with identical descriptions combined, as noted above).🤖 Generated with Claude Code
https://claude.ai/code/session_019jpxEQMLnxu4s6zSfHq8xR