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
38 changes: 38 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Upgrade To v2

This guide covers upgrading from the latest released v1 Node SDK to v2.

## Highlights

- Sending email now lives behind `Lettermint.email(token)`.
- The full Lettermint API is available through `Lettermint.api(token)`.
- Sending tokens use `x-lettermint-token`; full API tokens use `Authorization: Bearer`.
- `ping()` returns the raw trimmed `pong` response.
- Request and response types are generated from the OpenAPI specs and exported from the package.

## Replace Client Construction

```ts
import { Lettermint } from 'lettermint';

const email = Lettermint.email(process.env.LETTERMINT_SENDING_TOKEN!);
const api = Lettermint.api(process.env.LETTERMINT_API_TOKEN!);
```

Existing `new Lettermint({ apiToken })` email-builder usage still works for sending email.

## Batch Sending

```ts
await Lettermint.email(token).sendBatch([
{ from: 'sender@example.com', to: ['user@example.com'], subject: 'Hello', text: 'Hi' },
]);
```

## Full API

```ts
const domains = await Lettermint.api(token).domains.list();
const messageHtml = await Lettermint.api(token).messages.html('message-id');
```

2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"enabled": true
},
"files": {
"ignore": ["package.json"]
"ignore": ["package.json", "coverage/**", "dist/**", "src/types.ts"]
},
"linter": {
"enabled": true,
Expand Down
Loading
Loading