Skip to content

MT-22691: Contacts & events - #21

Merged
Lorenc326 merged 1 commit into
mainfrom
MT-22691-contacts
Jul 10, 2026
Merged

MT-22691: Contacts & events#21
Lorenc326 merged 1 commit into
mainfrom
MT-22691-contacts

Conversation

@Lorenc326

@Lorenc326 Lorenc326 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Motivation

Adds the Contacts core of the Email Marketing API to the Go SDK: manage contacts and record custom contact events.

Changes

  • Contacts (client.Contacts): Create / Get / Update / Delete by UUID or email. Responses are data:-unwrapped; requests wrap in {contact:…}. Update is an upsert — it returns {Action, Contact} reporting whether the contact was created or updated. The email identifier is URL-encoded for you.
  • ContactEvents (client.ContactEvents): Create — record a custom event (name + scalar params) for a contact.
  • httptest tests + examples/contacts + examples/contact-events + README "Email Marketing" entries.

Field shapes and paths verified against the OpenAPI spec (contacts).

How to test

  • go test -race ./...
  • go vet ./...
  • golangci-lint run ./...

Summary by CodeRabbit

  • New Features
    • Added contact management support (create, retrieve by ID/email, update/upsert, delete).
    • Added the ability to record custom events for a contact.
    • Exposed new client entry points for contacts and contact events.
    • Added new Go examples for contact workflows and contact event tracking.
  • Tests
    • Added tests covering contacts CRUD and contact event creation.
  • Documentation
    • Updated the README with new contact management section and example links.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bb0ab096-59cc-4f92-8606-867ca1ddbaf7

📥 Commits

Reviewing files that changed from the base of the PR and between 1929ea4 and b82c333.

📒 Files selected for processing (8)
  • README.md
  • client.go
  • contact_events.go
  • contact_events_test.go
  • contacts.go
  • contacts_test.go
  • examples/contact-events/main.go
  • examples/contacts/main.go
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (7)
  • contacts_test.go
  • contact_events_test.go
  • examples/contact-events/main.go
  • client.go
  • examples/contacts/main.go
  • contacts.go
  • contact_events.go

📝 Walkthrough

Walkthrough

Adds Contacts and Contact Events services to the Mailtrap Go client, wires them into the client, and adds tests, examples, and README links for the new email marketing functionality.

Changes

Email Marketing API additions

Layer / File(s) Summary
Contacts models and CRUD implementation
contacts.go, contacts_test.go
Adds contact models, request and response types, URL-escaped identifier handling, CRUD methods, and tests for ID/email lookup, updates, and deletion.
Contact Events model and Create implementation
contact_events.go, contact_events_test.go
Adds event models and a creation method that posts custom contact events, with request and response mapping tests.
Client wiring and examples/docs
client.go, examples/contacts/main.go, examples/contact-events/main.go, README.md
Exposes and initializes both services, adds end-to-end examples, and documents the new examples.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Example as Example Program
  participant Client
  participant ContactsService
  participant ContactEventsService
  participant MailtrapAPI

  Example->>Client: NewClient(token)
  Example->>Client: Contacts.Create(req)
  Client->>ContactsService: Create(req)
  ContactsService->>MailtrapAPI: POST /api/contacts
  MailtrapAPI-->>ContactsService: Contact
  ContactsService-->>Example: Contact

  Example->>Client: ContactEvents.Create(identifier, req)
  Client->>ContactEventsService: Create(identifier, req)
  ContactEventsService->>MailtrapAPI: POST /api/contacts/{identifier}/events
  MailtrapAPI-->>ContactEventsService: ContactEvent
  ContactEventsService-->>Example: ContactEvent
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change, covering contacts and custom events.
Description check ✅ Passed The description matches the template sections and covers the main changes; only the optional Images and GIFs section is missing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Lorenc326
Lorenc326 force-pushed the MT-22691-contacts branch from 526cb8b to 1929ea4 Compare July 9, 2026 09:19
@Lorenc326
Lorenc326 requested review from IgorDobryn and mklocek July 9, 2026 11:30
@Lorenc326
Lorenc326 force-pushed the MT-22691-contacts branch from 1929ea4 to b82c333 Compare July 10, 2026 10:35
@Lorenc326
Lorenc326 merged commit 46415fb into main Jul 10, 2026
4 checks passed
@Lorenc326
Lorenc326 deleted the MT-22691-contacts branch July 10, 2026 11:03
@github-actions github-actions Bot mentioned this pull request Jul 10, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Aug 7, 2026
2 tasks
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.

3 participants