Skip to content

Add App API segment & subscription methods (CDP-6266)#229

Open
mike-engel wants to merge 1 commit into
mainfrom
cdp-6266
Open

Add App API segment & subscription methods (CDP-6266)#229
mike-engel wants to merge 1 commit into
mainfrom
cdp-6266

Conversation

@mike-engel

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

Copy link
Copy Markdown
Collaborator

Batch 2 of the App API backfill. Adds 10 read/query methods to APIClient:

┌────────────────────────────┬───────────────────────────────────────────┐
│           Method           │                 Endpoint                  │
├────────────────────────────┼───────────────────────────────────────────┤
│ listSegments               │ GET /segments                             │
├────────────────────────────┼───────────────────────────────────────────┤
│ createSegment              │ POST /segments                            │
├────────────────────────────┼───────────────────────────────────────────┤
│ getSegment                 │ GET /segments/{id}                        │
├────────────────────────────┼───────────────────────────────────────────┤
│ deleteSegment              │ DELETE /segments/{id}                     │
├────────────────────────────┼───────────────────────────────────────────┤
│ getSegmentCustomerCount    │ GET /segments/{id}/customer_count         │
├────────────────────────────┼───────────────────────────────────────────┤
│ getSegmentMembership       │ GET /segments/{id}/membership (paginated) │
├────────────────────────────┼───────────────────────────────────────────┤
│ getSegmentUsedBy           │ GET /segments/{id}/used_by                │
├────────────────────────────┼───────────────────────────────────────────┤
│ listSubscriptionTopics     │ GET /subscription_topics                  │
├────────────────────────────┼───────────────────────────────────────────┤
│ listSubscriptionChannels   │ GET /subscription_channels                │
├────────────────────────────┼───────────────────────────────────────────┤
│ getSubscriptionCenterToken │ GET /subscription_center/{id}/token       │
└────────────────────────────┴───────────────────────────────────────────┘

Assisted with AI 🤖


Note

Medium Risk
Adds destructive segment APIs (deleteSegment) and subscription-center tokens; behavior is thin HTTP wrappers with tests, but callers can mutate workspace segments with a valid app key.

Overview
Adds 10 new APIClient methods (CDP-6266 batch 2) so the Node SDK can call segment and subscription App API endpoints that were not previously wrapped.

Segments: listSegments, createSegment (with new SegmentInput), getSegment, deleteSegment, getSegmentCustomerCount, paginated getSegmentMembership, and getSegmentUsedBy. Mutating calls use the same validation style as other client methods (MissingParamError, URL encoding).

Subscriptions: listSubscriptionTopics, listSubscriptionChannels, and getSubscriptionCenterToken for hosted preference links.

docs/app.md documents each method; unit tests assert URLs, payloads, and validation; live integration tests cover list/read paths plus a create→read→delete segment round-trip.

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

@mike-engel mike-engel self-assigned this Jul 6, 2026
Base automatically changed from cdp-6265 to main July 6, 2026 14:17
Batch 2 of the App API backfill. Adds ten methods to APIClient:

- listSegments / createSegment / getSegment / deleteSegment
- getSegmentCustomerCount / getSegmentMembership / getSegmentUsedBy
- listSubscriptionTopics / listSubscriptionChannels / getSubscriptionCenterToken

Reuses the buildQueryString helper from batch 1 for membership pagination.
Includes unit tests (100% coverage), live integration coverage (segment
create -> read -> delete round-trip + subscription reads), and docs in
docs/app.md.

Stacked on cdp-6265 (Batch 1) because it depends on the shared
buildQueryString helper; rebase onto main once Batch 1 lands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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