-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy patheverything.ts
More file actions
35 lines (27 loc) · 867 Bytes
/
everything.ts
File metadata and controls
35 lines (27 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { MailtrapClient } from "mailtrap";
const TOKEN = "<YOUR-TOKEN-HERE>";
const ACCOUNT_ID = "<YOUR-ACCOUNT-ID-HERE>"
const client = new MailtrapClient({
token: TOKEN,
accountId: ACCOUNT_ID,
});
async function contactListsFlow() {
// Create a new contact list
await client.contactLists.create({
name: "Test List",
});
// Get all contact lists
const all = await client.contactLists.getList();
console.log("All contact lists:", all);
// Get a specific contact list
const one = await client.contactLists.get(all[0].id);
console.log("One contact list:", one);
// Update a contact list
const updated = await client.contactLists.update(all[0].id, {
name: "Updated Test List",
});
console.log("Updated contact list:", updated);
// Delete a contact list
await client.contactLists.delete(all[0].id);
}
contactListsFlow();