Skip to content

feat(adapters): emailoctopus-style — lists, contacts lifecycle, fields, tags, campaigns reports - #60

Merged
deblasis merged 3 commits into
mainfrom
feat/emailoctopus-style
Aug 17, 2026
Merged

feat(adapters): emailoctopus-style — lists, contacts lifecycle, fields, tags, campaigns reports#60
deblasis merged 3 commits into
mainfrom
feat/emailoctopus-style

Conversation

@deblasis

Copy link
Copy Markdown
Contributor

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).

  • Lists CRUD with derived counts; double-opt-in lists default contacts to pending, single-opt-in to subscribed; duplicates → 409.
  • Contacts full lifecycle: create/get/update/delete, upsert both paths, batch with per-row 404s, status filters, unsubscribe/resubscribe; 32-hex ids from the lowercased email.
  • Fields + tags CRUD, merge-tag rename cascades to contacts.
  • Campaigns read-only (dashboard-authored in the real product): list/get + summary/links/contact reports; automation queue.
  • RFC 7807 problem+json errors with the provider's exact detail strings (Invalid key., Resource not found., …) and errors[{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.

…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.
@deblasis
deblasis merged commit 254d8bb into main Aug 17, 2026
1 check passed
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