feat: cover remaining documented Platform API endpoints - #30
Conversation
Adds the 24 operations present in the published OpenAPI spec but missing from
the kit, taking coverage from 73 to 97 of 99. The two left out (POST /v1/session,
POST /v1/token) mint bearer tokens and need an auth-model decision first.
New namespaces: me, refunds, taskComments.
Transport gains getRaw() because GET /v1/files/{id}/download streams
application/octet-stream rather than JSON.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Audited every z.enum in the SDK against assembly.com/docs/api-reference/openapi.json. Four were narrower than the API, so a documented value fails response validation and throws AssemblyResponseParseError for the whole payload — one client with an unlisted status discards every client in the page. - Client.status: add unknown, deleted (this is Sentry C1-APP-3, 170 events) - Client.creationMethod: add import - InvoiceStatus: add processing - TaskStatus: done -> completed. `done` is not in the spec and the live API never returns it; 45 of 51 sampled tasks are `completed`, so every one of them would have failed to parse. Breaking for anyone matching on "done". CustomFieldEntityType looked narrow too but is correct: the spec scopes it to client|company. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Pushed Every
Two existing tests asserted the bug — one required
|
Adds the 24 operations that are in Assembly's published OpenAPI spec but were missing from the kit, taking coverage from 73 to 97 of 99. Gaps were found by diffing
/docs/api-reference/openapi.jsonagainst every#transport.*call insrc/; the same diff confirms no kit method points at a route the spec no longer has.New namespaces:
me,refunds,taskComments. The rest are methods on existing namespaces — see the updated tables inREADME.mdandCLAUDE.md.Not included:
POST /v1/sessionandPOST /v1/token. Both mint bearer tokens, and the kit authenticates every request withX-API-Key: workspaceId/apiKey— whether a minted bearer replaces that header, coexists with it, or is handed back to the caller is a design decision, not a resource method./v1/sessionalso has no published doc page, only a spec entry.What to look at
src/transport/http.ts— newgetRaw().GET /v1/files/{id}/downloadstreamsapplication/octet-stream, so it can't go through.json(). Check the error mapping still applies (it shareswithErrorMapping).src/lib/modules/clients/schema.ts—ClientSchemanow builds from a sharedclientShapesoClientWithAppVisibilitySchemacan reuse it without duplicating 18 fields. Verify the refactor didn't change whatClientSchemaaccepts.src/lib/modules/files/schema.ts—clientPermissionsis modelled as"read_only" | "read_write", deliberately deviating from the spec, which declares that enum as one string,"read_only read_write". Worth a second opinion on whether that's a spec bug or a real wire format.src/lib/modules/forms/schema.ts—Formgainedfields/additionalFields. The create request needs them typed anyway, and they were previously being stripped from every form response.Verified / not verified
vp checkandvp packclean; 191 tests pass (19 new intests/resources.test.ts, asserting method, exact pathname, query params, and body per endpoint). Mutating four route strings was confirmed to fail the suite, so the assertions aren't vacuous.No request hit the real API — all 24 endpoints are exercised through an injected mock
fetch. Response schemas are therefore typed from the spec but unverified against live payloads;appVisibilityis typed loosely (Record<string, unknown>[]) because Assembly documents the field in prose but omits it from the OpenAPI response schema.