feat(adapters): emailoctopus-style — lists, contacts lifecycle, fields, tags, campaigns reports - #60
Merged
Merged
Conversation
…s, tags, campaigns reports
The 95th adapter, researched from the official v2 OpenAPI spec:
- Bearer API-key auth (the spec's securitySchemes), 401 problem+json
'Invalid key.'
- Lists CRUD with derived counts; double-opt-in lists default new
contacts to pending (help-center semantics), single-opt-in to
subscribed; duplicate email -> 409 Resource already exists.
- Contacts: create/get/update/delete + upsert + batch (per-row 404s),
status filters, unsubscribe/resubscribe flows; 32-hex ids derived
from the lowercased email (SHA-256 truncation — no MD5 builtin).
- Fields + tags CRUD (merge-tag rename cascades to contacts), RFC 7807
errors with exact detail strings and errors[{detail,pointer}] on 422,
data/paging.next.{url,starting_after} envelope with base64 cursors.
- Campaigns are read-only derived docs (v2 has no campaign create) with
summary/links/contact reports; automation queue endpoint.
- No webhook API exists in v2 (spec webhooks: {}) — nothing simulated.
… counts object, drop legacy tag routes
- Contacts are keyed per list (composite storage key, public id stays
the email hash): the same email joins multiple lists without a PK
clash (was a 500), and an email change to an address on ANOTHER list
no longer destroys the row — the destination is pre-checked and 409s
only within the same list, like the real API.
- List counts render as a plain object (the v2 schema), not a one-
element array — typed clients read counts.subscribed directly.
- Dropped the /lists/{id}/tags CRUD routes + script: they exist only
in the legacy 1.6 API, not v2 (verified against the official spec);
contact-level tags (create array / update map / ?tag= filter) are
the complete v2 surface and stay.
- Upsert/create now 422 on malformed tags/fields instead of silently
discarding them; automation queue resolves a contact on ANY list.
- Tests: per-list identity + cross-list rekey proof, list-delete
cascade now actually asserted (contact 404 after list delete),
counts object, tag-route absence 404.
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.
The 95th adapter, built from the official v2 OpenAPI spec (three brief corrections found during research: auth is Bearer not X-API-Key, paths are snake_case with no /v2 prefix, and v2 has no campaign-create or webhook API at all).
pending, single-opt-in tosubscribed; duplicates → 409.Invalid key.,Resource not found., …) anderrors[{detail,pointer|parameter}]on 422;data/paging.next.{url,starting_after}envelope, base64 cursors, limit default/cap 100.Gates: parse guard, QC boot (95 adapters), adapter lint, full engine suite, gofmt, vet — green. Lifecycle test covers auth negatives, both opt-in flows, every resource, error shapes, pagination, cascades, catch-all.