-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
160 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
import assert from 'assert'; | ||
import { InbucketAPIClient } from 'inbucket-js-client'; | ||
|
||
export const GET = (api: { $path: () => string }): string => `GET: ${api.$path()}`; | ||
export const POST = (api: { $path: () => string }): string => `POST: ${api.$path()}`; | ||
export const PATCH = (api: { $path: () => string }): string => `PATCH: ${api.$path()}`; | ||
export const DELETE = (api: { $path: () => string }): string => `DELETE: ${api.$path()}`; | ||
|
||
assert(process.env.INBUCKET_URL); | ||
|
||
export const inbucketClient = new InbucketAPIClient(process.env.INBUCKET_URL); | ||
|
||
export const fetchMailBodyAndTrash = async (email: string): Promise<string> => { | ||
const mailbox = await inbucketClient.mailbox(email); | ||
const message = await inbucketClient.message(email, mailbox[0].id); | ||
await inbucketClient.deleteMessage(email, mailbox[0].id); | ||
|
||
return message.body.text.trim(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters