Skip to content

feat: cover remaining documented Platform API endpoints - #30

Merged
priosshrsth merged 2 commits into
mainfrom
feat/api-coverage-gaps
Aug 18, 2026
Merged

feat: cover remaining documented Platform API endpoints#30
priosshrsth merged 2 commits into
mainfrom
feat/api-coverage-gaps

Conversation

@priosshrsth

Copy link
Copy Markdown
Collaborator

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.json against every #transport.* call in src/; 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 in README.md and CLAUDE.md.

Not included: POST /v1/session and POST /v1/token. Both mint bearer tokens, and the kit authenticates every request with X-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/session also has no published doc page, only a spec entry.

What to look at

  • src/transport/http.ts — new getRaw(). GET /v1/files/{id}/download streams application/octet-stream, so it can't go through .json(). Check the error mapping still applies (it shares withErrorMapping).
  • src/lib/modules/clients/schema.tsClientSchema now builds from a shared clientShape so ClientWithAppVisibilitySchema can reuse it without duplicating 18 fields. Verify the refactor didn't change what ClientSchema accepts.
  • src/lib/modules/files/schema.tsclientPermissions is 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.tsForm gained fields/additionalFields. The create request needs them typed anyway, and they were previously being stripped from every form response.

Verified / not verified

vp check and vp pack clean; 191 tests pass (19 new in tests/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; appVisibility is typed loosely (Record<string, unknown>[]) because Assembly documents the field in prose but omits it from the OpenAPI response schema.

priosshrsth and others added 2 commits August 18, 2026 08:39
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>
@priosshrsth

Copy link
Copy Markdown
Collaborator Author

Pushed 9440826 onto this branch — an enum audit against the published spec, prompted by Sentry C1-APP-3 (170 events in c1-api).

Every z.enum in the SDK was diffed against the spec. Four were narrower than the API, and because these are response schemas a single unlisted value throws AssemblyResponseParseError for the entire payload — one client with an undocumented status discards every client in the page.

schema change evidence
Client.status + unknown, deleted spec api.ClientItem.status lists 5; SDK had 3 — this is C1-APP-3
Client.creationMethod + import spec api.ClientItem.creationMethod
InvoiceStatus + processing spec invoice.Invoice.status
TaskStatus donecompleted not in spec, and the live API never sends it

TaskStatus is breaking for anyone matching on "done". It's a correction, not a widening: the spec lists todo\|inProgress\|completed in both TaskInput and the /v1/tasks query parameter, and sampling the live API returned 45 completed / 6 todo and zero done. Every completed task would have failed to parse. Nothing in this repo or in c1-apps referenced the old value.

Two existing tests asserted the bug — one required completed to be rejected, and a TasksResponseSchema fixture used done. Both corrected.

CustomFieldEntityType also looked narrow but is right: the spec scopes it to client\|company.

vp check clean, 193 tests pass. c1-apps needs a published version before C1-APP-3 stops firing.

@priosshrsth
priosshrsth merged commit 014d6f1 into main Aug 18, 2026
5 checks passed
@priosshrsth
priosshrsth deleted the feat/api-coverage-gaps branch August 18, 2026 08:55
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.

1 participant