Conversation
- PATCH sending domain to change settings - PUT / GET for company info
📝 WalkthroughWalkthroughAdded three new OpenAPI endpoints for managing sending domains: PATCH to update domain settings, GET and PUT operations for company information. Introduced four new schema definitions ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@specs/email-sending.openapi.yml`:
- Around line 771-818: The docs for the GET and PUT sending domain company_info
endpoints (see the GET block and the operationId updateSendingDomainCompanyInfo)
only include cURL samples—add x-codeSamples entries for the remaining languages
in the required priority order: Node.js (JavaScript), PHP, Python, Ruby, .NET
(C#), Java; for each language use the official Mailtrap SDK call that
corresponds to these endpoints (or the SDK method name if available) and show
authentication and payload for PUT (company_info object), and where an SDK does
not expose the operation include a short inline note stating the SDK limitation
and provide the equivalent generated HTTP client usage as fallback. Ensure
sample labels match existing x-codeSamples format and that PUT uses the same
company_info JSON fields shown in the cURL example.
- Around line 560-573: The new PATCH operation for the sending_domains endpoint
only includes a cURL sample under x-codeSamples, so add language-specific SDK
examples (in this priority: Node.js, PHP, Python, Ruby, .NET/C#, Java) to the
same x-codeSamples array for the PATCH
https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}
operation; for each language include an official Mailtrap SDK usage snippet that
performs the PATCH with the sending_domain JSON body (open_tracking_enabled,
click_tracking_enabled, auto_unsubscribe_link_enabled), and if any SDK lacks a
corresponding method, add a short explicit note in that language entry stating
the SDK limitation and provide the equivalent HTTP call via the SDK’s generic
request method or the GitBook-generated example.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 30df9ce6-91ee-4f5f-b5e3-518d94b2f912
📒 Files selected for processing (1)
specs/email-sending.openapi.yml
| x-codeSamples: | ||
| - lang: shell | ||
| label: 'cURL' | ||
| source: | | ||
| curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id} \ | ||
| -H 'Authorization: Bearer YOUR_API_KEY' \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{ | ||
| "sending_domain": { | ||
| "open_tracking_enabled": true, | ||
| "click_tracking_enabled": true, | ||
| "auto_unsubscribe_link_enabled": false | ||
| } | ||
| }' |
There was a problem hiding this comment.
Add the required SDK samples for this new PATCH operation.
This new endpoint only documents cURL, so the generated docs will be incomplete for the supported SDK surfaces. Please add Node.js, PHP, Python, Ruby, .NET, and Java samples here as well, or explicitly note any SDK limitation if one of them cannot express the call.
As per coding guidelines, "Include code samples in OpenAPI specs in this priority order: cURL (shell), Node.js (JavaScript), PHP, Python, Ruby, .NET (C#), Java" and "Use official Mailtrap SDKs for language-specific code examples in x-codeSamples; if SDK doesn't support a method, use GitBook generation or add a comment noting SDK limitations".
🧰 Tools
🪛 Betterleaks (1.1.1)
[high] 564-565: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@specs/email-sending.openapi.yml` around lines 560 - 573, The new PATCH
operation for the sending_domains endpoint only includes a cURL sample under
x-codeSamples, so add language-specific SDK examples (in this priority: Node.js,
PHP, Python, Ruby, .NET/C#, Java) to the same x-codeSamples array for the PATCH
https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}
operation; for each language include an official Mailtrap SDK usage snippet that
performs the PATCH with the sending_domain JSON body (open_tracking_enabled,
click_tracking_enabled, auto_unsubscribe_link_enabled), and if any SDK lacks a
corresponding method, add a short explicit note in that language entry stating
the SDK limitation and provide the equivalent HTTP call via the SDK’s generic
request method or the GitBook-generated example.
| x-codeSamples: | ||
| - lang: shell | ||
| label: 'cURL' | ||
| source: | | ||
| curl -X GET https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}/company_info \ | ||
| -H 'Authorization: Bearer YOUR_API_KEY' | ||
| parameters: | ||
| - $ref: '#/components/parameters/account_id' | ||
| - $ref: '#/components/parameters/sending_domain_id' | ||
| responses: | ||
| '200': | ||
| $ref: '#/components/responses/CompanyInfoResponse' | ||
| '401': | ||
| $ref: '#/components/responses/Unauthorized' | ||
| '403': | ||
| $ref: '#/components/responses/Forbidden' | ||
| '404': | ||
| $ref: '#/components/responses/NotFound' | ||
|
|
||
| put: | ||
| summary: Update company info | ||
| description: | | ||
| Create or update company information for a sending domain / account. | ||
| Company info is required for domain compliance verification. | ||
| operationId: updateSendingDomainCompanyInfo | ||
| tags: | ||
| - domains | ||
| x-codeSamples: | ||
| - lang: shell | ||
| label: 'cURL' | ||
| source: | | ||
| curl -X PUT https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}/company_info \ | ||
| -H 'Authorization: Bearer YOUR_API_KEY' \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{ | ||
| "company_info": { | ||
| "name": "Mailtrap", | ||
| "address": "123 Main St", | ||
| "city": "San Francisco", | ||
| "country": "US", | ||
| "zip_code": "94105", | ||
| "phone": "+1-555-0100", | ||
| "website_url": "https://mailtrap.io", | ||
| "privacy_policy_url": "https://mailtrap.io/privacy", | ||
| "terms_of_service_url": "https://mailtrap.io/terms", | ||
| "info_level": "business" | ||
| } | ||
| }' |
There was a problem hiding this comment.
Complete the company_info examples across the required languages.
Both new company_info operations currently stop at cURL. That leaves the docs inconsistent with the rest of the spec and with the repo’s required sample ordering. Please add the remaining official SDK examples for both GET and PUT, or call out unsupported SDK methods inline.
As per coding guidelines, "Include code samples in OpenAPI specs in this priority order: cURL (shell), Node.js (JavaScript), PHP, Python, Ruby, .NET (C#), Java" and "Use official Mailtrap SDKs for language-specific code examples in x-codeSamples; if SDK doesn't support a method, use GitBook generation or add a comment noting SDK limitations".
🧰 Tools
🪛 Betterleaks (1.1.1)
[high] 775-776: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
[high] 802-803: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@specs/email-sending.openapi.yml` around lines 771 - 818, The docs for the GET
and PUT sending domain company_info endpoints (see the GET block and the
operationId updateSendingDomainCompanyInfo) only include cURL samples—add
x-codeSamples entries for the remaining languages in the required priority
order: Node.js (JavaScript), PHP, Python, Ruby, .NET (C#), Java; for each
language use the official Mailtrap SDK call that corresponds to these endpoints
(or the SDK method name if available) and show authentication and payload for
PUT (company_info object), and where an SDK does not expose the operation
include a short inline note stating the SDK limitation and provide the
equivalent generated HTTP client usage as fallback. Ensure sample labels match
existing x-codeSamples format and that PUT uses the same company_info JSON
fields shown in the cURL example.
Motivation
Changes
- Add new endpoints to manage sending_domain settings and company_info
Summary by CodeRabbit