-
Notifications
You must be signed in to change notification settings - Fork 5
Update nodejs documentation #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
146ee76
eb14e89
4436b7b
1b9ce02
0fcb4fe
ea60bf7
9ab8960
df362c8
6e53054
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,11 +72,15 @@ paths: | |||||||||||||||||||||||||||||||
| accountId: YOUR_ACCOUNT_ID | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const domain = await client.sendingDomains.create({ | ||||||||||||||||||||||||||||||||
| domain_name: "example.com" | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
| async function createDomain() { | ||||||||||||||||||||||||||||||||
| const domain = await client.sendingDomains.create({ | ||||||||||||||||||||||||||||||||
| domain_name: "example.com" | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Created domain:", domain); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Created domain:", domain); | ||||||||||||||||||||||||||||||||
| createDomain(); | ||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -207,9 +211,12 @@ paths: | |||||||||||||||||||||||||||||||
| accountId: YOUR_ACCOUNT_ID | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const domains = await client.sendingDomains.getList(); | ||||||||||||||||||||||||||||||||
| async function getDomains() { | ||||||||||||||||||||||||||||||||
| const response = await client.sendingDomains.getList(); | ||||||||||||||||||||||||||||||||
| const domains = response.data; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Sending domains:", domains); | ||||||||||||||||||||||||||||||||
| getDomains(); | ||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -308,10 +315,14 @@ paths: | |||||||||||||||||||||||||||||||
| accountId: YOUR_ACCOUNT_ID | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const domainId = 12345; | ||||||||||||||||||||||||||||||||
| const domain = await client.sendingDomains.get(domainId); | ||||||||||||||||||||||||||||||||
| async function getDomain() { | ||||||||||||||||||||||||||||||||
| const domainId = 12345; | ||||||||||||||||||||||||||||||||
| const domain = await client.sendingDomains.get(domainId); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Domain details:", domain); | ||||||||||||||||||||||||||||||||
| console.log("Domain details:", domain); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| getDomain(); | ||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -410,10 +421,14 @@ paths: | |||||||||||||||||||||||||||||||
| accountId: YOUR_ACCOUNT_ID | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const domainId = 12345; | ||||||||||||||||||||||||||||||||
| await client.sendingDomains.delete(domainId); | ||||||||||||||||||||||||||||||||
| async function deleteDomain() { | ||||||||||||||||||||||||||||||||
| const domainId = 12345; | ||||||||||||||||||||||||||||||||
| await client.sendingDomains.delete(domainId); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Domain deleted successfully"); | ||||||||||||||||||||||||||||||||
| console.log("Domain deleted successfully"); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| deleteDomain(); | ||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -511,13 +526,17 @@ paths: | |||||||||||||||||||||||||||||||
| accountId: YOUR_ACCOUNT_ID | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const domainId = 12345; | ||||||||||||||||||||||||||||||||
| await client.sendingDomains.sendSetupInstructions( | ||||||||||||||||||||||||||||||||
| domainId, | ||||||||||||||||||||||||||||||||
| "devops@example.com" | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
| async function sendInstructions() { | ||||||||||||||||||||||||||||||||
| const domainId = 12345; | ||||||||||||||||||||||||||||||||
| await client.sendingDomains.sendSetupInstructions( | ||||||||||||||||||||||||||||||||
| domainId, | ||||||||||||||||||||||||||||||||
| "devops@example.com" | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Setup instructions sent"); | ||||||||||||||||||||||||||||||||
| console.log("Setup instructions sent"); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| sendInstructions(); | ||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -659,15 +678,19 @@ paths: | |||||||||||||||||||||||||||||||
| accountId: YOUR_ACCOUNT_ID | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Get all suppressions | ||||||||||||||||||||||||||||||||
| const suppressions = await client.suppressions.getList(); | ||||||||||||||||||||||||||||||||
| async function getSuppressions() { | ||||||||||||||||||||||||||||||||
| // Get all suppressions | ||||||||||||||||||||||||||||||||
| const suppressions = await client.suppressions.getList(); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Or search for specific email | ||||||||||||||||||||||||||||||||
| const filtered = await client.suppressions.getList({ | ||||||||||||||||||||||||||||||||
| email: "suppressed@example.com" | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
| // Or search for specific email | ||||||||||||||||||||||||||||||||
| const filtered = await client.suppressions.getList({ | ||||||||||||||||||||||||||||||||
| email: "suppressed@example.com" | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Suppressions:", suppressions); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Suppressions:", suppressions); | ||||||||||||||||||||||||||||||||
| getSuppressions(); | ||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -825,10 +848,14 @@ paths: | |||||||||||||||||||||||||||||||
| accountId: YOUR_ACCOUNT_ID | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const suppressionId = "abc123-def456"; | ||||||||||||||||||||||||||||||||
| const result = await client.suppressions.delete(suppressionId); | ||||||||||||||||||||||||||||||||
| async function deleteSuppression() { | ||||||||||||||||||||||||||||||||
| const suppressionId = "abc123-def456"; | ||||||||||||||||||||||||||||||||
| const result = await client.suppressions.delete(suppressionId); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Suppression removed:", result); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| console.log("Suppression removed:", result); | ||||||||||||||||||||||||||||||||
| deleteSuppression(); | ||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -937,8 +964,12 @@ paths: | |||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
| const { MailtrapClient } = require("mailtrap"); | ||||||||||||||||||||||||||||||||
| const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); | ||||||||||||||||||||||||||||||||
| const templates = await client.templates.getAll(); | ||||||||||||||||||||||||||||||||
| templates.forEach(tpl => console.log(`${tpl.name}: ${tpl.uuid}`)); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| async function getTemplates() { | ||||||||||||||||||||||||||||||||
| const templates = await client.templates.getList(); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| getTemplates(); | ||||||||||||||||||||||||||||||||
|
Comment on lines
+967
to
+972
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing output in The Suggested fix async function getTemplates() {
const templates = await client.templates.getList();
+
+ console.log("Templates:", templates);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -1022,14 +1053,19 @@ paths: | |||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
| import { MailtrapClient } from "mailtrap"; | ||||||||||||||||||||||||||||||||
| const client = new MailtrapClient({ token: "YOUR_API_TOKEN" }); | ||||||||||||||||||||||||||||||||
| const template = await client.templates.create({ | ||||||||||||||||||||||||||||||||
| name: "Welcome Email", | ||||||||||||||||||||||||||||||||
| subject: "Welcome to {{company_name}}!", | ||||||||||||||||||||||||||||||||
| category: "onboarding", | ||||||||||||||||||||||||||||||||
| body_html: "<h1>Welcome {{user_name}}!</h1>", | ||||||||||||||||||||||||||||||||
| body_text: "Welcome {{user_name}}!" | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
| console.log(`Template created: ${template.uuid}`); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| async function createTemplate() { | ||||||||||||||||||||||||||||||||
| const template = await client.templates.create({ | ||||||||||||||||||||||||||||||||
| name: "Welcome Email", | ||||||||||||||||||||||||||||||||
| subject: "Welcome to {{company_name}}!", | ||||||||||||||||||||||||||||||||
| category: "onboarding", | ||||||||||||||||||||||||||||||||
| body_html: "<h1>Welcome {{user_name}}!</h1>", | ||||||||||||||||||||||||||||||||
| body_text: "Welcome {{user_name}}!" | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
| console.log(`Template created: ${template.uuid}`); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| createTemplate(); | ||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -1164,8 +1200,13 @@ paths: | |||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
| const { MailtrapClient } = require("mailtrap"); | ||||||||||||||||||||||||||||||||
| const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); | ||||||||||||||||||||||||||||||||
| const template = await client.templates.get(templateId); | ||||||||||||||||||||||||||||||||
| console.log(`Template: ${template.name} (UUID: ${template.uuid})`); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| async function getTemplate() { | ||||||||||||||||||||||||||||||||
| const template = await client.templates.get(templateId); | ||||||||||||||||||||||||||||||||
| console.log(`Template: ${template.name} (UUID: ${template.uuid})`); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| getTemplate(); | ||||||||||||||||||||||||||||||||
|
Comment on lines
+1203
to
+1209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Suggested fix async function getTemplate() {
+ const templateId = 12345;
const template = await client.templates.get(templateId);
console.log(`Template: ${template.name} (UUID: ${template.uuid})`);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| - lang: ruby | ||||||||||||||||||||||||||||||||
| label: Ruby | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -1234,7 +1275,12 @@ paths: | |||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
| const { MailtrapClient } = require("mailtrap"); | ||||||||||||||||||||||||||||||||
| const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); | ||||||||||||||||||||||||||||||||
| const template = await client.templates.update(templateId, { name: "Updated Template", subject: "New Subject" }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| async function updateTemplate() { | ||||||||||||||||||||||||||||||||
| const template = await client.templates.update(templateId, { name: "Updated Template", subject: "New Subject" }); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| updateTemplate(); | ||||||||||||||||||||||||||||||||
|
Comment on lines
+1278
to
+1283
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Same issue as in Suggested fix async function updateTemplate() {
+ const templateId = 12345;
const template = await client.templates.update(templateId, { name: "Updated Template", subject: "New Subject" });
+
+ console.log("Template updated:", template);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| - lang: ruby | ||||||||||||||||||||||||||||||||
| label: Ruby | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -1335,7 +1381,12 @@ paths: | |||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
| const { MailtrapClient } = require("mailtrap"); | ||||||||||||||||||||||||||||||||
| const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); | ||||||||||||||||||||||||||||||||
| await client.templates.delete(templateId); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| async function deleteTemplate() { | ||||||||||||||||||||||||||||||||
| await client.templates.delete(templateId); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| deleteTemplate(); | ||||||||||||||||||||||||||||||||
|
Comment on lines
+1384
to
+1389
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Same issue - Suggested fix async function deleteTemplate() {
+ const templateId = 12345;
await client.templates.delete(templateId);
+
+ console.log("Template deleted successfully");
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| - lang: ruby | ||||||||||||||||||||||||||||||||
| label: Ruby | ||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||
|
|
@@ -1902,19 +1953,27 @@ components: | |||||||||||||||||||||||||||||||
| title: BadRequestResponse | ||||||||||||||||||||||||||||||||
| type: object | ||||||||||||||||||||||||||||||||
| properties: | ||||||||||||||||||||||||||||||||
| success: | ||||||||||||||||||||||||||||||||
| type: boolean | ||||||||||||||||||||||||||||||||
| example: false | ||||||||||||||||||||||||||||||||
| errors: | ||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||
| description: Error message | ||||||||||||||||||||||||||||||||
| example: Invalid request parameters | ||||||||||||||||||||||||||||||||
| type: array | ||||||||||||||||||||||||||||||||
| items: | ||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||
| example: "Invalid request parameters" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| RateLimitExceededResponse: | ||||||||||||||||||||||||||||||||
| title: RateLimitExceededResponse | ||||||||||||||||||||||||||||||||
| type: object | ||||||||||||||||||||||||||||||||
| properties: | ||||||||||||||||||||||||||||||||
| success: | ||||||||||||||||||||||||||||||||
| type: boolean | ||||||||||||||||||||||||||||||||
| example: false | ||||||||||||||||||||||||||||||||
| errors: | ||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||
| description: Error message | ||||||||||||||||||||||||||||||||
| example: Rate limit exceeded | ||||||||||||||||||||||||||||||||
| type: array | ||||||||||||||||||||||||||||||||
| items: | ||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||
| example: "Rate limit exceeded" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ErrorResponse: | ||||||||||||||||||||||||||||||||
| type: object | ||||||||||||||||||||||||||||||||
|
|
@@ -1935,13 +1994,21 @@ components: | |||||||||||||||||||||||||||||||
| application/json: | ||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||
| $ref: '#/components/schemas/ErrorResponse' | ||||||||||||||||||||||||||||||||
| example: | ||||||||||||||||||||||||||||||||
| success: false | ||||||||||||||||||||||||||||||||
| errors: | ||||||||||||||||||||||||||||||||
| - "Unauthorized" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Forbidden: | ||||||||||||||||||||||||||||||||
| description: Forbidden. Verify domain or check permissions. | ||||||||||||||||||||||||||||||||
| content: | ||||||||||||||||||||||||||||||||
| application/json: | ||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||
| $ref: '#/components/schemas/ErrorResponse' | ||||||||||||||||||||||||||||||||
| example: | ||||||||||||||||||||||||||||||||
| success: false | ||||||||||||||||||||||||||||||||
| errors: | ||||||||||||||||||||||||||||||||
| - "Forbidden" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| NotFound: | ||||||||||||||||||||||||||||||||
| description: Resource not found | ||||||||||||||||||||||||||||||||
|
|
@@ -1967,13 +2034,21 @@ components: | |||||||||||||||||||||||||||||||
| application/json: | ||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||
| $ref: '#/components/schemas/BadRequest' | ||||||||||||||||||||||||||||||||
| example: | ||||||||||||||||||||||||||||||||
| success: false | ||||||||||||||||||||||||||||||||
| errors: | ||||||||||||||||||||||||||||||||
| - "Invalid request parameters" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| LIMIT_EXCEEDED: | ||||||||||||||||||||||||||||||||
| description: Rate limit exceeded for the current account. | ||||||||||||||||||||||||||||||||
| content: | ||||||||||||||||||||||||||||||||
| application/json: | ||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||
| $ref: '#/components/schemas/RateLimitExceededResponse' | ||||||||||||||||||||||||||||||||
| example: | ||||||||||||||||||||||||||||||||
| success: false | ||||||||||||||||||||||||||||||||
| errors: | ||||||||||||||||||||||||||||||||
| - "Rate limit exceeded" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| SendingDomainResponse: | ||||||||||||||||||||||||||||||||
| description: Sending domain details | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -66,29 +66,28 @@ paths: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Add bulk: true for Bulk Stream | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const response = await client.batchSend({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| base: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from: { email: "sender@example.com" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| subject: "Important Update", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text: "Hello {{name}}, we have news for you." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| requests: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| to: [{ email: "user1@example.com" }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| custom_variables: { name: "Alice" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async function sendBatch() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const response = await client.batchSend({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| base: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from: { email: "sender@example.com" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| subject: "Important Update", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text: "Hello {{name}}, we have news for you." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| to: [{ email: "user2@example.com" }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| custom_variables: { name: "Bob" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| requests: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| to: [{ email: "user1@example.com" }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| custom_variables: { name: "Alice" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| to: [{ email: "user2@example.com" }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| custom_variables: { name: "Bob" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response.responses.forEach((result, index) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (result.success) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(`Email ${index + 1} sent`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sendBatch(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+69
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing output in The Suggested fix async function sendBatch() {
const response = await client.batchSend({
base: {
from: { email: "sender@example.com" },
subject: "Important Update",
text: "Hello {{name}}, we have news for you."
},
requests: [
{
to: [{ email: "user1@example.com" }],
custom_variables: { name: "Alice" }
},
{
to: [{ email: "user2@example.com" }],
custom_variables: { name: "Bob" }
}
]
});
+ console.log("Batch sent:", response);
}
sendBatch();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - lang: php | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| label: PHP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -532,13 +531,21 @@ components: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| application/json: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $ref: '#/components/schemas/SendEmailErrorResponse' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| success: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| errors: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "'from' address is invalid" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Unauthorized: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: Unauthorized. Check your API credentials. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| content: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| application/json: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $ref: '#/components/schemas/SendEmailErrorResponse' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| success: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| errors: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "Unauthorized" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| InternalError: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: Internal server error. Retry later or contact support. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing output in
getDomainsfunction.The
getDomainsfunction retrieves data but doesn't log or return anything useful. Unlike other samples (e.g.,createDomainat line 80), this one has noconsole.logto show the result.Suggested fix
async function getDomains() { const response = await client.sendingDomains.getList(); const domains = response.data; + + console.log("Domains:", domains); }📝 Committable suggestion
🤖 Prompt for AI Agents