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
608 changes: 592 additions & 16 deletions specs/account-management.openapi.yml

Large diffs are not rendered by default.

98 changes: 70 additions & 28 deletions specs/contacts.openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ paths:
label: 'cURL'
source: |
curl -X POST https://mailtrap.io/api/contacts \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contact": {
Expand All @@ -84,7 +84,7 @@ paths:
import { MailtrapClient } from "mailtrap";

const client = new MailtrapClient({
token: "YOUR_API_TOKEN"
token: "YOUR_API_KEY"
});

const contact = await client.contacts.create({
Expand Down Expand Up @@ -126,7 +126,7 @@ paths:
import mailtrap as mt

client = mt.MailtrapClient(
token="YOUR_API_TOKEN",
token="YOUR_API_KEY",
account_id="YOUR_ACCOUNT_ID"
)

Expand All @@ -148,7 +148,7 @@ paths:
source: |
require 'mailtrap'

client = Mailtrap::Client.new(api_key: 'YOUR_API_TOKEN')
client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
contacts = Mailtrap::ContactsAPI.new(account_id, client)

contact = contacts.create(
Expand Down Expand Up @@ -197,7 +197,7 @@ paths:
import java.util.HashMap;

var config = new MailtrapConfig.Builder()
.token("YOUR_API_TOKEN")
.token("YOUR_API_KEY")
.build();

var client = MailtrapClientFactory
Expand Down Expand Up @@ -273,14 +273,14 @@ paths:
label: 'cURL'
source: |
curl -X GET https://mailtrap.io/api/contacts/{contact_identifier} \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
import { MailtrapClient } from "mailtrap";

const client = new MailtrapClient({
token: "YOUR_API_TOKEN"
token: "YOUR_API_KEY"
});

// Get by contact ID
Expand Down Expand Up @@ -318,7 +318,7 @@ paths:
import mailtrap as mt

client = mt.MailtrapClient(
token="YOUR_API_TOKEN",
token="YOUR_API_KEY",
account_id="YOUR_ACCOUNT_ID"
)

Expand All @@ -337,7 +337,7 @@ paths:
source: |
require 'mailtrap'

client = Mailtrap::Client.new(api_key: 'YOUR_API_TOKEN')
client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
contacts = Mailtrap::ContactsAPI.new(account_id, client)

# Get by contact ID
Expand Down Expand Up @@ -380,7 +380,7 @@ paths:
import java.net.URLEncoder;

var config = new MailtrapConfig.Builder()
.token("YOUR_API_TOKEN")
.token("YOUR_API_KEY")
.build();

var client = MailtrapClientFactory
Expand Down Expand Up @@ -426,7 +426,7 @@ paths:
label: 'cURL'
source: |
curl -X PATCH https://mailtrap.io/api/contacts/{contact_identifier} \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"contact": { "email": "new@example.com", "fields": {"first_name": "John"}}}'
- lang: javascript
Expand Down Expand Up @@ -558,7 +558,7 @@ paths:
label: 'cURL'
source: |
curl -X DELETE https://mailtrap.io/api/contacts/{contact_identifier} \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down Expand Up @@ -651,7 +651,7 @@ paths:
label: 'cURL'
source: |
curl -X POST https://mailtrap.io/api/contacts/{contact_identifier}/events \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name": "UserLogin", "params": {"user_id": 101, "is_active": true}}'
- lang: javascript
Expand Down Expand Up @@ -701,6 +701,21 @@ paths:
)
)
print(event)
- lang: ruby
label: Ruby
source: |
require 'mailtrap'

client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
account_id = 1000001
contact_events = Mailtrap::ContactEventsAPI.new(account_id, client)

event = contact_events.create(
'contact_id',
name: 'UserLogin',
params: { user_id: 101, is_active: true }
)
puts event
Comment thread
mklocek marked this conversation as resolved.
- lang: csharp
label: C#
source: |
Expand Down Expand Up @@ -776,7 +791,7 @@ paths:
label: 'cURL'
source: |
curl -X POST https://mailtrap.io/api/contacts/exports \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"filters": [{"name": "list_id", "operator": "equal", "value": [1, 2]}]}'
- lang: javascript
Expand Down Expand Up @@ -820,6 +835,21 @@ paths:
]
)
print(f"Export started: {export_job.id}")
- lang: ruby
label: Ruby
source: |
require 'mailtrap'

client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
account_id = 1000001
contact_exports = Mailtrap::ContactExportsAPI.new(account_id, client)

export_job = contact_exports.create(
filters: [
{ name: 'list_id', operator: 'equal', value: [1, 2] }
]
)
puts export_job
- lang: csharp
label: C#
source: |
Expand Down Expand Up @@ -895,7 +925,7 @@ paths:
label: 'cURL'
source: |
curl -X GET https://mailtrap.io/api/contacts/exports/{export_id} \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down Expand Up @@ -929,6 +959,18 @@ paths:

export_status = client.contacts_api.contact_exports.get_by_id(export_id)
print(f"Status: {export_status.status}, URL: {export_status.url}")
- lang: ruby
label: Ruby
source: |
require 'mailtrap'

client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
account_id = 1000001
contact_exports = Mailtrap::ContactExportsAPI.new(account_id, client)

export_id = 12345
export_status = contact_exports.get(export_id)
puts export_status
- lang: csharp
label: C#
source: |
Expand Down Expand Up @@ -992,7 +1034,7 @@ paths:
label: 'cURL'
source: |
curl -X POST https://mailtrap.io/api/contacts/imports \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"contacts": [{"email": "user1@example.com", "fields": {"first_name": "John"}, "list_ids_included": [1, 2]}]}'
- lang: javascript
Expand Down Expand Up @@ -1136,7 +1178,7 @@ paths:
label: 'cURL'
source: |
curl -X GET https://mailtrap.io/api/contacts/imports/{import_id} \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down Expand Up @@ -1243,11 +1285,11 @@ paths:
label: 'cURL'
source: |
curl -X GET https://mailtrap.io/api/contacts/lists \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'

# Filter lists by name (case-insensitive prefix match)
curl -X GET 'https://mailtrap.io/api/contacts/lists?search=news' \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down Expand Up @@ -1339,7 +1381,7 @@ paths:
label: 'cURL'
source: |
curl -X POST https://mailtrap.io/api/contacts/lists \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name": "Customers"}'
- lang: javascript
Expand Down Expand Up @@ -1440,7 +1482,7 @@ paths:
label: 'cURL'
source: |
curl -X GET https://mailtrap.io/api/contacts/lists/{list_id} \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down Expand Up @@ -1525,7 +1567,7 @@ paths:
label: 'cURL'
source: |
curl -X PATCH https://mailtrap.io/api/contacts/lists/{list_id} \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name": "Former Customers"}'
- lang: javascript
Expand Down Expand Up @@ -1629,7 +1671,7 @@ paths:
label: 'cURL'
source: |
curl -X DELETE https://mailtrap.io/api/contacts/lists/{list_id} \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down Expand Up @@ -1711,7 +1753,7 @@ paths:
label: 'cURL'
source: |
curl -X GET https://mailtrap.io/api/contacts/fields \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down Expand Up @@ -1808,7 +1850,7 @@ paths:
label: 'cURL'
source: |
curl -X POST https://mailtrap.io/api/contacts/fields \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name": "Company", "data_type": "text", "merge_tag": "company"}'
- lang: javascript
Expand Down Expand Up @@ -1943,7 +1985,7 @@ paths:
label: 'cURL'
source: |
curl -X GET https://mailtrap.io/api/contacts/fields/{field_id} \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down Expand Up @@ -2032,7 +2074,7 @@ paths:
label: 'cURL'
source: |
curl -X PATCH https://mailtrap.io/api/contacts/fields/{field_id} \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name": "Updated Name", "merge_tag": "updated_name"}'
- lang: javascript
Expand Down Expand Up @@ -2158,7 +2200,7 @@ paths:
label: 'cURL'
source: |
curl -X DELETE https://mailtrap.io/api/contacts/fields/{field_id} \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
Expand Down
Loading
Loading