fix(sdk): align proposal detail contract + document routes with deployed API#74
Merged
Merged
Conversation
…yed API
GetProposalByIdResult was missing fields the deployed /proposals/{id}
endpoint returns (verified against InsurUp core GetProposalDetailResult):
agentBranchId, policyStartDate/policyEndDate, per-product
hasUndamagedDiscountRate / isManual / manualPdfUrl / optimalCoverage, and
coverageGroups carried a wrong inner shape (coverage: Coverage instead of
coverageTable: CoverageTable + description).
Route fixes (source of truth: InsurUpApiEndpoints.cs):
- premium detail: premium-detail/{n} -> premiums/{n}
- information form fetch/send: information-form -> information-form-document
- customer document pdf: missing /products/ segment
New:
- proposals.addManualProduct() — multipart POST to
proposals/{id}/products/manual with PascalCase form fields + optional
PDF under 'file', matching the official C# SDK wire shape
- optional language on both document fetch requests, appended as ?language=
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Preparation for the agent-panel proposal detail page surfaced several places where the TS SDK drifted from the deployed InsurUp API. Source of truth for every change: the core repo (
GetProposalDetailResult.cs,InsurUpApiEndpoints.cs,AddManualProductEndpoint.cs, and the official C# SDK'sDefaultInsurUpClient.Proposal.cs).Contract fixes —
GetProposalByIdResultThe deployed
GET /proposals/{id}returns fields the TS type didn't model:agentBranchId,policyStartDate,policyEndDatehasUndamagedDiscountRate,isManual,manualPdfUrl,optimalCoveragecoverageGroups[]inner shape was wrong: hadcoverage: Coverage; the wire sendscoverageTable: CoverageTable(+ optionaldescription). The old field never existed at runtime, so this is a fix, not a break.Route fixes (would 404 against the deployed API)
getProposalProductPremiumDetail…/premium-detail/{n}…/premiums/{n}fetchProposalInformationFormDocument…/information-form…/information-form-documentsendProposalInformationFormDocument…/information-form/send…/information-form-document/sendgenerateCustomerProposalDocumentPdfproposals/{id}/customer-document-pdfproposals/{id}/products/customer-document-pdfNew
proposals.addManualProduct(request, pdf?)— multipart POST toproposals/{id}/products/manualwith PascalCase form fields + optional PDF underfile(mirrors the C# SDK exactly, incl.AllowFileUploadsbinding on the endpoint).languageon both document fetch requests, appended as?language=(parity with C#AppendLanguageQuery; the legacy panel's per-branch PDF language menu depends on it).Test Plan
bun run typecheck(all packages)bun run build(all packages)bun run test— 894 tests green, incl. newproposal-client.spec.tscovering the manual-product multipart shape, fixed routes, and language querybun run lint+bun run format:check🤖 Generated with Claude Code