Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions specs/email-api.openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ paths:
async function getDomains() {
const response = await client.sendingDomains.getList();
const domains = response.data;

console.log("Sending domains:", domains);
}

getDomains();
Expand Down Expand Up @@ -967,6 +969,8 @@ paths:

async function getTemplates() {
const templates = await client.templates.getList();

console.log("Templates:", templates);
}

getTemplates();
Expand Down Expand Up @@ -1202,7 +1206,9 @@ paths:
const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID });

async function getTemplate() {
const templateId = 12345;
const template = await client.templates.get(templateId);

console.log(`Template: ${template.name} (UUID: ${template.uuid})`);
}

Expand Down Expand Up @@ -1277,7 +1283,10 @@ paths:
const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID });

async function updateTemplate() {
const templateId = 12345;
const template = await client.templates.update(templateId, { name: "Updated Template", subject: "New Subject" });

console.log(`Template updated: ${template.name} (UUID: ${template.uuid})`);
}

updateTemplate();
Expand Down Expand Up @@ -1383,7 +1392,10 @@ paths:
const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: YOUR_ACCOUNT_ID });

async function deleteTemplate() {
const templateId = 12345;
await client.templates.delete(templateId);

console.log("Template deleted successfully");
}

deleteTemplate();
Expand Down
3 changes: 2 additions & 1 deletion specs/email-batch.openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ paths:
import { MailtrapClient } from "mailtrap";

const client = new MailtrapClient({
token: process.env.MAILTRAP_API_KEY
token: process.env.MAILTRAP_API_KEY,
// Add bulk: true for Bulk Stream
});

Expand All @@ -85,6 +85,7 @@ paths:
]
});

console.log("Batch sent:", response);
}

sendBatch();
Expand Down
2 changes: 1 addition & 1 deletion specs/email-sending-transactional.openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ paths:
import { MailtrapClient } from "mailtrap";

const client = new MailtrapClient({
token: process.env.MAILTRAP_API_KEY
token: process.env.MAILTRAP_API_KEY,
});

async function sendEmail() {
Expand Down
79 changes: 62 additions & 17 deletions specs/sandbox.openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@
async function getProject() {
const projectId = 12345;
const project = await client.testing.projects.get(projectId);

console.log("Project:", project);
}

getProject();
Expand Down Expand Up @@ -484,11 +486,10 @@
projectId,
"Updated Project Name"
);
console.log("Project updated:", updatedProject);
}

updateProject();

console.log("Project updated:", updatedProject);
- lang: php
label: PHP
source: |
Expand Down Expand Up @@ -638,6 +639,8 @@
async function deleteProject() {
const projectId = 12345;
const result = await client.testing.projects.delete(projectId);

console.log("Project deleted:", result);
}

deleteProject();
Expand Down Expand Up @@ -783,22 +786,26 @@
source: |
import { MailtrapClient } from "mailtrap";

const TOKEN = "YOUR_API_TOKEN";
const ACCOUNT_ID = "YOUR_ACCOUNT_ID";

const client = new MailtrapClient({
token: "YOUR_API_TOKEN",
token: TOKEN,
accountId: ACCOUNT_ID
});

async function createInbox() {
const projectId = 12345;
const inbox = await client.testing.inboxes.create(
projectId,
'My Test Inbox'
);

console.log(`Inbox created: ${inbox.name}`);
console.log(`SMTP credentials - User: ${inbox.username}`);
}

createInbox();

console.log(`Inbox created: ${inbox.name}`);
console.log(`SMTP credentials - User: ${inbox.username}`);
- lang: php
label: PHP
source: |
Expand Down Expand Up @@ -917,6 +924,8 @@
async function getInboxAttributes() {
const inboxId = 12345;
const inboxAttributes = await client.testing.inboxes.getInboxAttributes(inboxId);

console.log(inboxAttributes);
}

getInboxAttributes();
Expand Down Expand Up @@ -1018,6 +1027,8 @@
async function deleteInbox() {
const inboxId = 12345;
const result = await client.testing.inboxes.delete(inboxId);

console.log(result);
}

deleteInbox();
Expand Down Expand Up @@ -1138,11 +1149,10 @@
inboxId,
{ name: 'Updated Inbox Name', emailUsername: 'new-username' }
);
console.log(updatedInbox);
}

updateInbox();

console.log(updatedInbox);
- lang: php
label: PHP
source: |
Expand Down Expand Up @@ -1272,6 +1282,8 @@
async function cleanInbox() {
const inboxId = 12345;
const result = await client.testing.inboxes.clean(inboxId);

console.log(result);
}

cleanInbox();
Expand Down Expand Up @@ -1378,6 +1390,8 @@
async function markAsRead() {
const inboxId = 12345;
const result = await client.testing.inboxes.markAsRead(inboxId);

console.log(result);
}

markAsRead();
Expand Down Expand Up @@ -1484,6 +1498,8 @@
async function resetCredentials() {
const inboxId = 12345;
const result = await client.testing.inboxes.resetCredentials(inboxId);

console.log(result);
}

resetCredentials();
Expand Down Expand Up @@ -1590,6 +1606,8 @@
async function enableEmailAddress() {
const inboxId = 12345;
const result = await client.testing.inboxes.enableEmailAddress(inboxId);

console.log(result);
}

enableEmailAddress();
Expand Down Expand Up @@ -1696,6 +1714,8 @@
async function resetEmailAddress() {
const inboxId = 12345;
const result = await client.testing.inboxes.resetEmailAddress(inboxId);

console.log(result);
}

resetEmailAddress();
Expand Down Expand Up @@ -2382,13 +2402,12 @@

const client = new MailtrapClient({ token: TOKEN, accountId: ACCOUNT_ID });

const inboxId = 12345;
const messageId = 67890;

async function showMessage() {
const inboxId = 12345;
const messageId = 67890;
const message = await client.testing.messages.showEmailMessage(inboxId, messageId);

console.log(message);
}

showMessage();
Expand Down Expand Up @@ -2609,11 +2628,11 @@
messageId,
{ isRead: true }
);

console.log(updatedMessage);
}

updateMessage();

console.log(updatedMessage);
- lang: php
label: PHP
source: |
Expand Down Expand Up @@ -2816,6 +2835,8 @@
const inboxId = 12345;
const messageId = 67890;
const result = await client.testing.messages.deleteMessage(inboxId, messageId);

console.log(result);
}

deleteMessage();
Expand Down Expand Up @@ -3017,7 +3038,10 @@
});

async function getMessages() {
const inboxId = 12345;
const messages = await client.testing.messages.get(inboxId);

console.log(messages);
}

getMessages();
Expand Down Expand Up @@ -3191,11 +3215,11 @@
messageId,
'recipient@example.com'
);

console.log(result);
}

forwardMessage();

console.log(result);
- lang: php
label: PHP
source: |
Expand Down Expand Up @@ -3361,6 +3385,8 @@

async function getSpamScore() {
const spamReport = await client.testing.messages.getSpamScore(12345, 67890);

console.log(spamReport);
}

getSpamScore();
Expand Down Expand Up @@ -3528,6 +3554,8 @@

async function getHtmlAnalysis() {
const htmlAnalysis = await client.testing.messages.getHtmlAnalysis(12345, 67890);

console.log(htmlAnalysis);
}

getHtmlAnalysis();
Expand Down Expand Up @@ -3643,6 +3671,8 @@

async function getTextMessage() {
const textBody = await client.testing.messages.getTextMessage(12345, 67890);

console.log(textBody);
}

getTextMessage();
Expand Down Expand Up @@ -3803,6 +3833,8 @@

async function getRawMessage() {
const rawBody = await client.testing.messages.getRawMessage(12345, 67890);

console.log(rawBody);
}

getRawMessage();
Expand Down Expand Up @@ -3942,6 +3974,8 @@

async function getHtmlSource() {
const htmlSource = await client.testing.messages.getMessageHtmlSource(12345, 67890);

console.log(htmlSource);
}

getHtmlSource();
Expand Down Expand Up @@ -4073,12 +4107,15 @@
const { MailtrapClient } = require("mailtrap");
const client = new MailtrapClient({ token: "YOUR_API_KEY", accountId: "YOUR_ACCOUNT_ID" });

const ACCOUNT_ID = "YOUR_ACCOUNT_ID";

async function getHtmlMessage() {
const htmlBody = await client.testing.messages.getHtmlMessage(12345, 67890);
const htmlBody = await client.testing.messages.getHtmlMessage(ACCOUNT_ID, 12345, 67890);

console.log(htmlBody);
}

getHtmlMessage();
console.log(htmlBody);
- lang: php
label: PHP
source: |
Expand Down Expand Up @@ -4236,6 +4273,8 @@

async function getMessageAsEml() {
const emlContent = await client.testing.messages.getMessageAsEml(12345, 67890);

console.log(emlContent);
}

getMessageAsEml();
Expand Down Expand Up @@ -4349,6 +4388,8 @@

async function getMailHeaders() {
const mailHeaders = await client.testing.messages.getMailHeaders(12345, 67890);

console.log(mailHeaders);
}

getMailHeaders();
Expand Down Expand Up @@ -4497,6 +4538,8 @@

async function getAttachments() {
const attachments = await client.testing.attachments.getList(67890, 12345);

console.log(attachments);
}

getAttachments();
Expand Down Expand Up @@ -4635,6 +4678,8 @@

async function getAttachment() {
const attachment = await client.testing.attachments.get(12345, 67890, 222222);

console.log(attachment);
}

getAttachment();
Expand Down Expand Up @@ -4701,7 +4746,7 @@
- $ref: '#/components/parameters/attachment_id'
components:
schemas:
Inbox:

Check warning on line 4749 in specs/sandbox.openapi.yml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI files with Spectral

oas3-unused-component Potentially unused component has been detected.
$ref: '#/components/schemas/TestingInbox'
InboxMessageWithoutBlacklistsReportInfo:
title: Message without blacklists report
Expand Down
Loading