Skip to content

Commit

Permalink
bruno-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmahoney committed Nov 25, 2024
1 parent 543f0fa commit 0d8ffb7
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bruno-api-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Bruno email examples
How to send and receive email in Bruno API client.

## Setup
1. Open this folder using [Bruno](http://usebruno.com).
2. Configure the Authentication environment {{apiKey}} variable to use your [MailSlurp API KEY](https://app.mailslurp.com).

24 changes: 24 additions & 0 deletions bruno-api-client/mailslurp-examples/Create an inbox.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta {
name: Create an inbox
type: http
seq: 2
}

post {
url: https://api.mailslurp.com/inboxes/withDefaults
body: none
auth: apikey
}

auth:apikey {
key: x-api-key
value: {{apiKey}}
placement: header
}

script:post-response {
const data = res.getBody();
bru.setVar('emailAddress', data.emailAddress);
bru.setVar('inboxId', data.id);

}
17 changes: 17 additions & 0 deletions bruno-api-client/mailslurp-examples/Get emails.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
meta {
name: Get emails
type: http
seq: 3
}

get {
url: https://api.mailslurp.com/inboxes/{{inboxId}}/emails
body: none
auth: apikey
}

auth:apikey {
key: x-api-key
value: {{apiKey}}
placement: header
}
23 changes: 23 additions & 0 deletions bruno-api-client/mailslurp-examples/Read email.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
meta {
name: Read email
type: http
seq: 6
}

get {
url: https://api.mailslurp.com/emails/{{emailId}}
body: none
auth: apikey
}

auth:apikey {
key: x-api-key
value: {{apiKey}}
placement: header
}

script:post-response {
const data = res.getBody();
bru.setVar('emailId', data.id);

}
25 changes: 25 additions & 0 deletions bruno-api-client/mailslurp-examples/Send email.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
meta {
name: Send email
type: http
seq: 4
}

post {
url: https://api.mailslurp.com/inboxes/{{inboxId}}/confirm
body: json
auth: apikey
}

auth:apikey {
key: x-api-key
value: {{apiKey}}
placement: header
}

body:json {
{
"to": ["{{emailAddress}}"],
"subject": "Test email",
"body": "Hello world"
}
}
29 changes: 29 additions & 0 deletions bruno-api-client/mailslurp-examples/Wait for email.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
meta {
name: Wait for email
type: http
seq: 5
}

get {
url: https://api.mailslurp.com/waitForLatestEmail?inboxId={{inboxId}}&timeout=60000&unreadOnly=true
body: none
auth: apikey
}

params:query {
inboxId: {{inboxId}}
timeout: 60000
unreadOnly: true
}

auth:apikey {
key: x-api-key
value: {{apiKey}}
placement: header
}

script:post-response {
const data = res.getBody();
bru.setVar('emailId', data.id);

}
9 changes: 9 additions & 0 deletions bruno-api-client/mailslurp-examples/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": "1",
"name": "MailSlurp Examples",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}
3 changes: 3 additions & 0 deletions bruno-api-client/mailslurp-examples/collection.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docs {
This collection demonstrates how to create email accounts in Bruno then send and receive emails using API requests.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vars:secret [
apiKey
]

0 comments on commit 0d8ffb7

Please sign in to comment.