Skip to content

Commit

Permalink
docs: add OneSecMail
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRouchut committed Mar 31, 2023
1 parent 1a36471 commit 3dacffc
Showing 1 changed file with 47 additions and 2 deletions.
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,52 @@ const options: Partial<Options> = {

## OneSecMail

Soon...
### Create a mailbox

```ts
const mailbox = await OneSecMail();
const mailbox = await OneSecMail("[email protected]");
const mailbox = await OneSecMail(options);
const mailbox = await OneSecMail("[email protected]", options);
```

Returns an instance of `OneSecMailbox`.

### OneSecMailbox.getMessages([options])

```ts
const messages = await mailbox.getMessages();
const messages = await mailbox.getMessages(options);
```

Returns an array of `OneSecMailShortMessage` instances.

### OneSecMailbox.clearMessages([options])

```ts
await mailbox.clearMessages();
await mailbox.clearMessages(options);
```

### OneSecMailShortMessage.fetchFullMessage([options])

```ts
const fullMessage = await message.fetchFullMessage();
const fullMessage = await message.fetchFullMessage(options);
```

Returns an instance of `OneSecMailMessage` if the message still exists, otherwise throw an error.

`OneSecMailMessage` has an **attachments** field that contains an array of `OneSecMailAttachment` instances.

### OneSecMailAttachment.download([options])

```ts
const file = await attachment.download();
const file = await attachment.download(options);
```

Returns a Buffer if the file still exists, otherwise throw an error.

## OneSecMailAPI

Expand All @@ -113,7 +158,7 @@ const api = new OneSecMailAPI(options);

### Instance methods

All methods return a _Promise_.
All methods return a **Promise**.

#### genRandomMailbox([count[, options]])

Expand Down

0 comments on commit 3dacffc

Please sign in to comment.