Skip to content

feat: add App API Collections methods#242

Merged
mike-engel merged 2 commits into
mainfrom
cdp-6275
Jul 15, 2026
Merged

feat: add App API Collections methods#242
mike-engel merged 2 commits into
mainfrom
cdp-6275

Conversation

@mike-engel

@mike-engel mike-engel commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Another set of the App API backfill which adds the 7 collection endpoints to APIClient:

Method Endpoint
listCollections GET /v1/collections
createCollection POST /v1/collections
getCollection GET /v1/collections/{id}
updateCollection PUT /v1/collections/{id}
deleteCollection DELETE /v1/collections/{id} (204)
getCollectionContent GET /v1/collections/{id}/content
updateCollectionContent PUT /v1/collections/{id}/content

Assisted by AI 🤖

Implementation note

updateCollectionContent sends a top-level array. The shared RequestData type stays object-shaped (widening it globally broke track.ts, which does property access on request bodies), so the array is cast at that one call site — the transport already JSON.stringifys it correctly. lib/request.ts is unchanged.


Note

Medium Risk
Large additive API surface including ESP suppression mutations and imports; risk is mitigated by following existing client patterns and extensive stub/live tests rather than changing core transport.

Overview
Expands APIClient with a broad App API backfill: new typed request/option shapes and methods wired through the existing request helpers, plus matching docs/app.md sections and unit/live integration coverage.

Collections — CRUD plus getCollectionContent / updateCollectionContent for row data. updateCollectionContent PUTs a top-level JSON array; the body is cast at that call site so shared RequestData stays object-shaped elsewhere.

Deliverability — ESP suppression search/list (workspace and per-domain), create/delete suppressions; reporting webhook CRUD.

Content & ops — Snippet list/create/upsert/delete; sender identity list/get/used-by; workspace-wide message list/get/archived content; CSV createImport / getImport; data-index batchUpdateAttributes / batchUpdateEvents; listWorkspaces and getIpAddresses.

Live tests exercise round-trips where safe (collections, suppressions, webhooks, snippets, imports when CIO_TEST_IMPORT_CSV_URL is set).

Reviewed by Cursor Bugbot for commit 385c6cd. Bugbot is set up for automated code reviews on this repo. Configure here.

Batch 11. Adds the 7 collection endpoints to APIClient: list/create/get/
update/delete plus get/replace content.

Verified against the services backend (ext_api/collections/*), not the
OpenAPI spec:
- Collection ids are integers; create/update take { name, data?, url? } with
  data and url mutually exclusive; DELETE returns 204 (and 409s if the
  collection is still used by a campaign).
- The content endpoints carry a raw top-level JSON array of row objects
  (not an object), so updateCollectionContent posts the array directly.

Includes unit tests (100% coverage), live round-trip coverage, and docs.
@mike-engel mike-engel changed the title feat: add App API Collections methods (CDP-6275) feat: add App API Collections methods Jul 15, 2026
@mike-engel mike-engel self-assigned this Jul 15, 2026
karngyan
karngyan previously approved these changes Jul 15, 2026
@mike-engel
mike-engel merged commit 2fe30ab into main Jul 15, 2026
11 checks passed
@mike-engel
mike-engel deleted the cdp-6275 branch July 15, 2026 13:12
@mike-engel mike-engel mentioned this pull request Jul 15, 2026
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