Skip to content

Add SDK code samples to email campaigns endpoints - #54

Open
Rabsztok wants to merge 1 commit into
mainfrom
campaigns-sdk-samples
Open

Add SDK code samples to email campaigns endpoints#54
Rabsztok wants to merge 1 commit into
mainfrom
campaigns-sdk-samples

Conversation

@Rabsztok

@Rabsztok Rabsztok commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Motivation

Every one of the 11 operations in
specs/email-campaigns.openapi.yml carried only a shell sample, while sibling specs
(e.g. createContact in contacts.openapi.yml) carry the full SDK set. Campaigns were
the only spec with no SDK samples at all.

Changes

  • Add javascript, php, python, ruby, csharp and java samples to all 11 email
    campaign operations, in the language order and with the label conventions the sibling
    specs already use. Existing shell samples are untouched.
  • Every sample is written against the campaigns API each SDK actually ships on its
    origin/main — verified method by method, not inferred from the spec.

Coverage is complete: 6 languages x 11 operations, no gaps. All six SDKs already ship
full email-campaigns support, so nothing had to be skipped:

Operation Node.js PHP Python Ruby .NET Java
getEmailCampaigns yes yes yes yes yes yes
createEmailCampaign yes yes yes yes yes yes
getEmailCampaign yes yes yes yes yes yes
updateEmailCampaign yes yes yes yes yes yes
deleteEmailCampaign yes yes yes yes yes yes
startEmailCampaign yes yes yes yes yes yes
scheduleEmailCampaign yes yes yes yes yes yes
cancelEmailCampaign yes yes yes yes yes yes
terminateEmailCampaign yes yes yes yes yes yes
resetEmailCampaign yes yes yes yes yes yes
getEmailCampaignStats yes yes yes yes yes yes

Entry points used, for reviewer reference:

  • Node.js — client.emailCampaigns.{getList,create,get,update,delete,start,schedule,cancel,terminate,reset,getStats}
  • PHP — (new MailtrapGeneralClient($config))->emailCampaigns($accountId)->…EmailCampaign…()
  • Python — client.email_campaigns_api.email_campaigns.{get_list,create,get_by_id,update,delete,start,schedule,cancel,terminate,reset,get_stats}
  • Ruby — Mailtrap::EmailCampaignsAPI.new(client).{list,get,create,update,delete,start,schedule,cancel,terminate,reset,stats}
  • .NET — client.EmailCampaigns() (collection) and client.EmailCampaign(id) (single)
  • Java — client.emailCampaignsApi().emailCampaigns().…EmailCampaign…()

The campaigns endpoints are token-scoped, so Node.js, Python, Ruby, .NET and Java need no
account id; PHP's resource still takes one for consistency with the other General API
resources, and the sample passes it.

Diff is purely additive (1038 insertions, 0 deletions) — no base-URL, description, or
operation-ordering changes.

Out of scope, deliberately untouched: createSuppression and the three
tracking_opt_outs operations in email-sending.openapi.yml also lack ruby samples.

How to test

  • Spectral reports no errors for specs/*.openapi.yml
  • In the rendered GitBook docs, each email campaigns operation offers cURL, Node.js,
    PHP, Python, Ruby, .NET and Java tabs, in that order
  • Spot-check createEmailCampaign and updateEmailCampaign: the sample bodies use the
    fields the spec defines (name, domain_id, from_display_name, from_local_part,
    reply_to, template_attributes, delivery_mode, delivery_options,
    contact_list_ids, contact_segment_ids), and scheduleEmailCampaign uses datetime

All 11 email campaign operations carried only a shell sample. Add
javascript, php, python, ruby, csharp and java samples to each, matching
the language order and label conventions of the sibling specs.

Every sample is written against the campaigns API that each SDK actually
ships on origin/main, so all six languages cover all 11 operations.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5abd5093-8bed-4fbe-990d-ba8401fa7b32


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.

@Rabsztok
Rabsztok marked this pull request as ready for review August 31, 2026 11:25
@Rabsztok
Rabsztok requested review from IgorDobryn and izikaj August 31, 2026 11:26
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