diff --git a/specs/email-api.openapi.yml b/specs/email-api.openapi.yml index 1f41d7c..6dcd82b 100644 --- a/specs/email-api.openapi.yml +++ b/specs/email-api.openapi.yml @@ -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(); - 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: "

Welcome {{user_name}}!

", - 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: "

Welcome {{user_name}}!

", + 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(); - 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(); - 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(); - 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,6 +1994,10 @@ components: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + example: + success: false + errors: + - "Unauthorized" Forbidden: description: Forbidden. Verify domain or check permissions. @@ -1942,6 +2005,10 @@ components: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + example: + success: false + errors: + - "Forbidden" NotFound: description: Resource not found @@ -1967,6 +2034,10 @@ 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. @@ -1974,6 +2045,10 @@ components: application/json: schema: $ref: '#/components/schemas/RateLimitExceededResponse' + example: + success: false + errors: + - "Rate limit exceeded" SendingDomainResponse: description: Sending domain details diff --git a/specs/email-batch.openapi.yml b/specs/email-batch.openapi.yml index af10630..f25e047 100644 --- a/specs/email-batch.openapi.yml +++ b/specs/email-batch.openapi.yml @@ -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(); - lang: php label: PHP source: | @@ -532,6 +531,10 @@ components: application/json: schema: $ref: '#/components/schemas/SendEmailErrorResponse' + example: + success: false + errors: + - "'from' address is invalid" Unauthorized: description: Unauthorized. Check your API credentials. @@ -539,6 +542,10 @@ components: application/json: schema: $ref: '#/components/schemas/SendEmailErrorResponse' + example: + success: false + errors: + - "Unauthorized" InternalError: description: Internal server error. Retry later or contact support. diff --git a/specs/email-sending-bulk.openapi.yml b/specs/email-sending-bulk.openapi.yml index 66a2c81..017c989 100644 --- a/specs/email-sending-bulk.openapi.yml +++ b/specs/email-sending-bulk.openapi.yml @@ -55,22 +55,25 @@ paths: source: | import { MailtrapClient } from "mailtrap"; - // Initialize client for bulk sending const client = new MailtrapClient({ token: process.env.MAILTRAP_API_KEY, bulk: true }); - await client.send({ - from: { email: "marketing@example.com" }, - to: [ - { email: "subscriber1@example.com" }, - { email: "subscriber2@example.com" } - ], - subject: "Monthly Newsletter", - html: "

Our Latest Updates

", - category: "newsletter" - }); + async function sendEmail() { + await client.send({ + from: { email: "marketing@example.com" }, + to: [ + { email: "subscriber1@example.com" }, + { email: "subscriber2@example.com" } + ], + subject: "Monthly Newsletter", + html: "

Our Latest Updates

", + category: "newsletter" + }); + } + + sendEmail(); - lang: php label: PHP source: | @@ -149,7 +152,6 @@ paths: using Mailtrap.Configuration; using Mailtrap.Emails.Requests; - // Initialize client for bulk sending var config = new MailtrapClientOptions { ApiToken = "YOUR_API_KEY", @@ -503,6 +505,10 @@ components: application/json: schema: $ref: '#/components/schemas/SendEmailErrorResponse' + example: + success: false + errors: + - "'from' address is invalid" Unauthorized: description: Unauthorized. Check your API credentials. @@ -510,6 +516,10 @@ components: application/json: schema: $ref: '#/components/schemas/SendEmailErrorResponse' + example: + success: false + errors: + - "Unauthorized" Forbidden: description: Forbidden. Verify domain or check permissions. diff --git a/specs/email-sending-transactional.openapi.yml b/specs/email-sending-transactional.openapi.yml index b1d43b9..5936896 100644 --- a/specs/email-sending-transactional.openapi.yml +++ b/specs/email-sending-transactional.openapi.yml @@ -60,16 +60,20 @@ paths: token: process.env.MAILTRAP_API_KEY }); - await client.send({ - from: { - email: "sender@example.com", - name: "Sender Name" - }, - to: [{ email: "recipient@example.com" }], - subject: "Hello from Mailtrap", - text: "Welcome to Mailtrap!", - html: "

Welcome to Mailtrap!

" - }); + async function sendEmail() { + await client.send({ + from: { + email: "sender@example.com", + name: "Sender Name" + }, + to: [{ email: "recipient@example.com" }], + subject: "Hello from Mailtrap", + text: "Welcome to Mailtrap!", + html: "

Welcome to Mailtrap!

" + }); + } + + sendEmail(); - lang: php label: PHP source: | @@ -475,6 +479,10 @@ components: application/json: schema: $ref: '#/components/schemas/SendEmailErrorResponse' + example: + success: false + errors: + - "'from' address is invalid" Unauthorized: description: Unauthorized. Check your API credentials. @@ -482,6 +490,10 @@ components: application/json: schema: $ref: '#/components/schemas/SendEmailErrorResponse' + example: + success: false + errors: + - "Unauthorized" Forbidden: description: Forbidden. Verify domain or check permissions. diff --git a/specs/general.openapi.yml b/specs/general.openapi.yml index 565e8b4..e7e44f7 100644 --- a/specs/general.openapi.yml +++ b/specs/general.openapi.yml @@ -185,13 +185,11 @@ paths: token: "YOUR_API_TOKEN" }); - const accounts = await client.accounts.list(); + async function listAccounts() { + const accounts = await client.general.accounts.getAllAccounts(); + } - accounts.forEach(account => { - console.log(`Account: ${account.name}`); - console.log(`ID: ${account.id}`); - console.log(`Access Level: ${account.access_levels[0]}`); - }); + listAccounts(); - lang: php label: PHP source: | @@ -299,8 +297,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); - const accesses = await client.accountAccesses.list(); - accesses.forEach(access => console.log(`User: ${access.specifier.email}, Level: ${access.permission_level}`)); + + async function listAccesses() { + const accesses = await client.general.accountAccesses.listAccountAccesses(); + } + + listAccesses(); - lang: php label: PHP source: | @@ -405,7 +407,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); - await client.accountAccesses.delete(accessId); + + async function deleteAccess() { + await client.general.accountAccesses.removeAccountAccess(accessId); + } + + deleteAccess(); - lang: php label: PHP source: | @@ -492,9 +499,14 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); - await client.permissions.bulkUpdate(accessId, { - permissions: [{ resource_id: "3281", resource_type: "account", access_level: "viewer" }] - }); + + async function bulkUpdatePermissions() { + await client.general.permissions.bulkPermissionsUpdate(accessId, [ + { resourceId: "3281", resourceType: "account", accessLevel: "viewer" } + ]); + } + + bulkUpdatePermissions(); - lang: php label: PHP source: | @@ -661,8 +673,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); - const resources = await client.permissions.getResources(); - console.log(resources); + + async function getResources() { + const resources = await client.general.permissions.getResources(); + } + + getResources(); - lang: php label: PHP source: | @@ -773,8 +789,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID }); - const usage = await client.billing.getUsage(); - console.log(`Sandbox sent: ${usage.testing.usage.sent_messages_count.current}/${usage.testing.usage.sent_messages_count.limit}`); + + async function getUsage() { + const usage = await client.general.billing.getCurrentBillingCycleUsage(); + } + + getUsage(); - lang: php label: PHP source: | diff --git a/specs/sandbox.openapi.yml b/specs/sandbox.openapi.yml index 167bbc3..eb3870c 100644 --- a/specs/sandbox.openapi.yml +++ b/specs/sandbox.openapi.yml @@ -124,11 +124,13 @@ paths: accountId: ACCOUNT_ID }); - const project = await client.testing.projects.create({ - name: 'My New Project' - }); + async function createProject() { + const project = await client.testing.projects.create({ + name: 'My New Project' + }); + } - console.log(project); + createProject(); - lang: php label: PHP source: | @@ -248,11 +250,11 @@ paths: accountId: ACCOUNT_ID }); - const projects = await client.testing.projects.getList(); + async function getProjects() { + const projects = await client.testing.projects.getList(); + } - projects.forEach(project => { - console.log(`Project: ${project.name}, ID: ${project.id}`); - }); + getProjects(); - lang: php label: PHP source: | @@ -369,10 +371,12 @@ paths: accountId: YOUR_ACCOUNT_ID }); - const projectId = 12345; - const project = await client.testing.projects.get(projectId); + async function getProject() { + const projectId = 12345; + const project = await client.testing.projects.get(projectId); + } - console.log("Project:", project); + getProject(); - lang: php label: PHP source: | @@ -474,11 +478,15 @@ paths: accountId: YOUR_ACCOUNT_ID }); - const projectId = 12345; - const updatedProject = await client.testing.projects.update( - projectId, - "Updated Project Name" - ); + async function updateProject() { + const projectId = 12345; + const updatedProject = await client.testing.projects.update( + projectId, + "Updated Project Name" + ); + } + + updateProject(); console.log("Project updated:", updatedProject); - lang: php @@ -627,10 +635,12 @@ paths: accountId: YOUR_ACCOUNT_ID }); - const projectId = 12345; - const result = await client.testing.projects.delete(projectId); + async function deleteProject() { + const projectId = 12345; + const result = await client.testing.projects.delete(projectId); + } - console.log("Project deleted:", result); + deleteProject(); - lang: php label: PHP source: | @@ -778,10 +788,14 @@ paths: accountId: ACCOUNT_ID }); - const inbox = await client.testing.inboxes.create( - projectId, - 'My Test Inbox' - ); + async function createInbox() { + const inbox = await client.testing.inboxes.create( + projectId, + 'My Test Inbox' + ); + } + + createInbox(); console.log(`Inbox created: ${inbox.name}`); console.log(`SMTP credentials - User: ${inbox.username}`); @@ -900,10 +914,12 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxId = 12345; - const inboxAttributes = await client.testing.inboxes.getInboxAttributes(inboxId); + async function getInboxAttributes() { + const inboxId = 12345; + const inboxAttributes = await client.testing.inboxes.getInboxAttributes(inboxId); + } - console.log(inboxAttributes); + getInboxAttributes(); - lang: php label: PHP source: | @@ -999,10 +1015,12 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxId = 12345; - const result = await client.testing.inboxes.delete(inboxId); + async function deleteInbox() { + const inboxId = 12345; + const result = await client.testing.inboxes.delete(inboxId); + } - console.log(result); + deleteInbox(); - lang: php label: PHP source: | @@ -1114,11 +1132,15 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxId = 12345; - const updatedInbox = await client.testing.inboxes.updateInbox( - inboxId, - { name: 'Updated Inbox Name', emailUsername: 'new-username' } - ); + async function updateInbox() { + const inboxId = 12345; + const updatedInbox = await client.testing.inboxes.updateInbox( + inboxId, + { name: 'Updated Inbox Name', emailUsername: 'new-username' } + ); + } + + updateInbox(); console.log(updatedInbox); - lang: php @@ -1247,10 +1269,12 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxId = 12345; - const result = await client.testing.inboxes.clean(inboxId); + async function cleanInbox() { + const inboxId = 12345; + const result = await client.testing.inboxes.clean(inboxId); + } - console.log(result); + cleanInbox(); - lang: php label: PHP source: | @@ -1351,10 +1375,12 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxId = 12345; - const result = await client.testing.inboxes.markAsRead(inboxId); + async function markAsRead() { + const inboxId = 12345; + const result = await client.testing.inboxes.markAsRead(inboxId); + } - console.log(result); + markAsRead(); - lang: php label: PHP source: | @@ -1455,10 +1481,12 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxId = 12345; - const result = await client.testing.inboxes.resetCredentials(inboxId); + async function resetCredentials() { + const inboxId = 12345; + const result = await client.testing.inboxes.resetCredentials(inboxId); + } - console.log(result); + resetCredentials(); - lang: php label: PHP source: | @@ -1559,10 +1587,12 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxId = 12345; - const result = await client.testing.inboxes.enableEmailAddress(inboxId); + async function enableEmailAddress() { + const inboxId = 12345; + const result = await client.testing.inboxes.enableEmailAddress(inboxId); + } - console.log(result); + enableEmailAddress(); - lang: php label: PHP source: | @@ -1663,10 +1693,12 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxId = 12345; - const result = await client.testing.inboxes.resetEmailAddress(inboxId); + async function resetEmailAddress() { + const inboxId = 12345; + const result = await client.testing.inboxes.resetEmailAddress(inboxId); + } - console.log(result); + resetEmailAddress(); - lang: php label: PHP source: | @@ -1766,9 +1798,11 @@ paths: const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID }); - const inboxes = await client.testing.inboxes.getList(); + async function getInboxes() { + const inboxes = await client.testing.inboxes.getList(); + } - console.log(inboxes); + getInboxes(); - lang: php label: PHP source: | @@ -1859,13 +1893,17 @@ paths: sandbox: true }); - await client.send({ - from: { email: "test@example.com", name: "Test Sender" }, - to: [{ email: "user@example.com", name: "Test User" }], - subject: "Test Email", - text: "This is a test email for sandbox.", - html: "

This is a test email for sandbox.

" - }); + async function sendTestEmail() { + await client.send({ + from: { email: "test@example.com", name: "Test Sender" }, + to: [{ email: "user@example.com", name: "Test User" }], + subject: "Test Email", + text: "This is a test email for sandbox.", + html: "

This is a test email for sandbox.

" + }); + } + + sendTestEmail(); - lang: php label: PHP source: | @@ -2347,9 +2385,13 @@ paths: const inboxId = 12345; const messageId = 67890; - const message = await client.testing.messages.showEmailMessage(inboxId, messageId); + async function showMessage() { + const inboxId = 12345; + const messageId = 67890; + const message = await client.testing.messages.showEmailMessage(inboxId, messageId); + } - console.log(message); + showMessage(); - lang: php label: PHP source: | @@ -2559,11 +2601,17 @@ paths: const inboxId = 12345; const messageId = 67890; - const updatedMessage = await client.testing.messages.updateMessage( - inboxId, - messageId, - { isRead: true } - ); + async function updateMessage() { + const inboxId = 12345; + const messageId = 67890; + const updatedMessage = await client.testing.messages.updateMessage( + inboxId, + messageId, + { isRead: true } + ); + } + + updateMessage(); console.log(updatedMessage); - lang: php @@ -2764,9 +2812,13 @@ paths: const inboxId = 12345; const messageId = 67890; - const result = await client.testing.messages.deleteMessage(inboxId, messageId); + async function deleteMessage() { + const inboxId = 12345; + const messageId = 67890; + const result = await client.testing.messages.deleteMessage(inboxId, messageId); + } - console.log(result); + deleteMessage(); - lang: php label: PHP source: | @@ -2964,13 +3016,11 @@ paths: accountId: ACCOUNT_ID }); - const messages = await client.testing.messages.getList(inboxId); + async function getMessages() { + const messages = await client.testing.messages.get(inboxId); + } - messages.forEach(message => { - console.log(`From: ${message.from_email}`); - console.log(`Subject: ${message.subject}`); - console.log(`Received: ${message.created_at}`); - }); + getMessages(); - lang: php label: PHP source: | @@ -3133,11 +3183,17 @@ paths: const inboxId = 12345; const messageId = 67890; - const result = await client.testing.messages.forward( - inboxId, - messageId, - 'recipient@example.com' - ); + async function forwardMessage() { + const inboxId = 12345; + const messageId = 67890; + const result = await client.testing.messages.forward( + inboxId, + messageId, + 'recipient@example.com' + ); + } + + forwardMessage(); console.log(result); - lang: php @@ -3303,8 +3359,11 @@ paths: const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const spamReport = await client.testing.messages.getSpamScore(12345, 67890); - console.log(spamReport); + async function getSpamScore() { + const spamReport = await client.testing.messages.getSpamScore(12345, 67890); + } + + getSpamScore(); - lang: php label: PHP source: | @@ -3467,8 +3526,11 @@ paths: const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const htmlAnalysis = await client.testing.messages.getHtmlAnalysis(12345, 67890); - console.log(htmlAnalysis); + async function getHtmlAnalysis() { + const htmlAnalysis = await client.testing.messages.getHtmlAnalysis(12345, 67890); + } + + getHtmlAnalysis(); - lang: php label: PHP source: | @@ -3578,8 +3640,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const textBody = await client.testing.messages.getTextMessage(12345, 67890); - console.log(textBody); + + async function getTextMessage() { + const textBody = await client.testing.messages.getTextMessage(12345, 67890); + } + + getTextMessage(); - lang: php label: PHP source: | @@ -3734,8 +3800,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const rawBody = await client.testing.messages.getRawMessage(12345, 67890); - console.log(rawBody); + + async function getRawMessage() { + const rawBody = await client.testing.messages.getRawMessage(12345, 67890); + } + + getRawMessage(); - lang: php label: PHP source: | @@ -3869,8 +3939,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const htmlSource = await client.testing.messages.getMessageHtmlSource(12345, 67890); - console.log(htmlSource); + + async function getHtmlSource() { + const htmlSource = await client.testing.messages.getMessageHtmlSource(12345, 67890); + } + + getHtmlSource(); - lang: php label: PHP source: | @@ -3998,7 +4072,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const htmlBody = await client.testing.messages.getHtmlMessage(12345, 67890); + + async function getHtmlMessage() { + const htmlBody = await client.testing.messages.getHtmlMessage(12345, 67890); + } + + getHtmlMessage(); console.log(htmlBody); - lang: php label: PHP @@ -4154,8 +4233,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const emlContent = await client.testing.messages.getMessageAsEml(12345, 67890); - console.log(emlContent); + + async function getMessageAsEml() { + const emlContent = await client.testing.messages.getMessageAsEml(12345, 67890); + } + + getMessageAsEml(); - lang: php label: PHP source: | @@ -4263,8 +4346,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const mailHeaders = await client.testing.messages.getMailHeaders(12345, 67890); - console.log(mailHeaders); + + async function getMailHeaders() { + const mailHeaders = await client.testing.messages.getMailHeaders(12345, 67890); + } + + getMailHeaders(); - lang: php label: PHP source: | @@ -4407,7 +4494,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const attachments = await client.testing.attachments.getList(67890, 12345); + + async function getAttachments() { + const attachments = await client.testing.attachments.getList(67890, 12345); + } + + getAttachments(); - lang: php label: PHP source: | @@ -4540,7 +4632,12 @@ paths: source: | const { MailtrapClient } = require("mailtrap"); const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" }); - const attachment = await client.testing.attachments.get(12345, 67890, 222222); + + async function getAttachment() { + const attachment = await client.testing.attachments.get(12345, 67890, 222222); + } + + getAttachment(); - lang: php label: PHP source: |