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
5 changes: 2 additions & 3 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
publish:
name: publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -34,3 +31,5 @@ jobs:
- name: Publish to NPM
run: |
bash ./bin/publish-npm
env:
NPM_TOKEN: ${{ secrets.POSTGRID_NPM_TOKEN || secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ jobs:
- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.POSTGRID_NPM_TOKEN || secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ dist-deno
/*.tgz
.idea/
.eslintcache
oidc

2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.6.1"
".": "0.7.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 119
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/postgrid/postgrid-3c7d57bbfb43bd794b71e33005d57e8e05469854cd30340b491df0819d145adc.yml
openapi_spec_hash: 3562a11137635f5a513f3c1ae8421fda
config_hash: c97dc4db121f63642b688d1ec0923a6d
configured_endpoints: 137
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/postgrid/postgrid-a1e82d54f9c6456622ef353b6864dd9ccc47c9b5cf6b5fbe98c123f2bdf30f34.yml
openapi_spec_hash: cd682fda35a9733c4bcd508b8d8e6eab
config_hash: f16e8e5b59ab878eee700d0f2dee5645
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.7.0 (2026-06-12)

Full Changelog: [v0.6.1...v0.7.0](https://github.com/postgrid/postgrid-node/compare/v0.6.1...v0.7.0)

### Features

* **api:** update api with events and webhook capabilities ([76f555a](https://github.com/postgrid/postgrid-node/commit/76f555ade3f03eae1fbf31e8972b5761c77c8223))
* New endpoints, fixed and aligned schemas ([763499e](https://github.com/postgrid/postgrid-node/commit/763499e0c794e44eb5ff4372e76fefed195eefef))
* PE-6131 HOTFIX: Fix idempotency key header for create endpoints ([086b129](https://github.com/postgrid/postgrid-node/commit/086b129ea75f1c609397dfb5ef57abd09a71771a))
* Update available premium paper IDs ([d21b5de](https://github.com/postgrid/postgrid-node/commit/d21b5def4f3c93fc7fa6e7c1955e727ea8f0a795))


### Bug Fixes

* **typescript:** upgrade tsc-multi so that it works with Node 26 ([0e7287b](https://github.com/postgrid/postgrid-node/commit/0e7287bebc5f0eeea9be3c2aa222df39fa585de1))


### Chores

* **tests:** remove redundant File import ([608fd6b](https://github.com/postgrid/postgrid-node/commit/608fd6b49fd48ab782be29541184ba9aa5197516))

## 0.6.1 (2026-05-14)

Full Changelog: [v0.6.0...v0.6.1](https://github.com/postgrid/postgrid-node/compare/v0.6.0...v0.6.1)
Expand Down
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,55 @@ const response: PostGrid.AddressVerificationVerifyResponse =

Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.

## File uploads

Request parameters that correspond to file uploads can be passed in many different forms:

- `File` (or an object with the same structure)
- a `fetch` `Response` (or an object with the same structure)
- an `fs.ReadStream`
- the return value of our `toFile` helper

```ts
import fs from 'fs';
import PostGrid, { toFile } from 'postgrid-node';

const client = new PostGrid();

// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
await client.bulkVerification.upload({
file: fs.createReadStream('/path/to/file'),
mappings: { line1: 'line1' },
name: 'name',
});

// Or if you have the web `File` API you can pass a `File` instance:
await client.bulkVerification.upload({
file: new File(['my bytes'], 'file'),
mappings: { line1: 'line1' },
name: 'name',
});

// You can also pass a `fetch` `Response`:
await client.bulkVerification.upload({
file: await fetch('https://somesite/file'),
mappings: { line1: 'line1' },
name: 'name',
});

// Finally, if none of the above are convenient, you can use our `toFile` helper:
await client.bulkVerification.upload({
file: await toFile(Buffer.from('my bytes'), 'file'),
mappings: { line1: 'line1' },
name: 'name',
});
await client.bulkVerification.upload({
file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
mappings: { line1: 'line1' },
name: 'name',
});
```

## Handling errors

When the library is unable to connect to the API,
Expand Down
90 changes: 79 additions & 11 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ Methods:
- <code title="get /v1/intl_addver/completions">client.intlAddressVerification.<a href="./src/resources/intl-address-verification.ts">getAutocompletePreviews</a>({ ...params }) -> IntlAddressVerificationGetAutocompletePreviewsResponse</code>
- <code title="post /v1/intl_addver/verifications">client.intlAddressVerification.<a href="./src/resources/intl-address-verification.ts">verify</a>({ ...params }) -> IntlAddressVerificationVerifyResponse</code>

# BulkVerification

Types:

- <code><a href="./src/resources/bulk-verification.ts">AddverList</a></code>
- <code><a href="./src/resources/bulk-verification.ts">BulkVerificationRetrieveResponse</a></code>
- <code><a href="./src/resources/bulk-verification.ts">BulkVerificationListResponse</a></code>
- <code><a href="./src/resources/bulk-verification.ts">BulkVerificationUploadResponse</a></code>

Methods:

- <code title="get /v1/addver_lists/{id}">client.bulkVerification.<a href="./src/resources/bulk-verification.ts">retrieve</a>(id) -> BulkVerificationRetrieveResponse</code>
- <code title="get /v1/addver_lists">client.bulkVerification.<a href="./src/resources/bulk-verification.ts">list</a>({ ...params }) -> BulkVerificationListResponse</code>
- <code title="post /v1/addver_lists">client.bulkVerification.<a href="./src/resources/bulk-verification.ts">upload</a>({ ...params }) -> BulkVerificationUploadResponse</code>

# PrintMail

## Contacts
Expand Down Expand Up @@ -98,6 +113,33 @@ Methods:
- <code title="delete /print-mail/v1/trackers/{id}">client.printMail.trackers.<a href="./src/resources/print-mail/trackers.ts">delete</a>(id) -> TrackerDeleteResponse</code>
- <code title="get /print-mail/v1/trackers/{id}/visits">client.printMail.trackers.<a href="./src/resources/print-mail/trackers.ts">retrieveVisits</a>(id, { ...params }) -> TrackerRetrieveVisitsResponsesSkipLimit</code>

## Webhooks

Types:

- <code><a href="./src/resources/print-mail/webhooks.ts">Webhook</a></code>
- <code><a href="./src/resources/print-mail/webhooks.ts">WebhookInvocation</a></code>
- <code><a href="./src/resources/print-mail/webhooks.ts">WebhookDeleteResponse</a></code>

Methods:

- <code title="post /print-mail/v1/webhooks">client.printMail.webhooks.<a href="./src/resources/print-mail/webhooks.ts">create</a>({ ...params }) -> Webhook</code>
- <code title="get /print-mail/v1/webhooks/{id}">client.printMail.webhooks.<a href="./src/resources/print-mail/webhooks.ts">retrieve</a>(id) -> Webhook</code>
- <code title="post /print-mail/v1/webhooks/{id}">client.printMail.webhooks.<a href="./src/resources/print-mail/webhooks.ts">update</a>(id, { ...params }) -> Webhook</code>
- <code title="get /print-mail/v1/webhooks">client.printMail.webhooks.<a href="./src/resources/print-mail/webhooks.ts">list</a>({ ...params }) -> WebhooksSkipLimit</code>
- <code title="delete /print-mail/v1/webhooks/{id}">client.printMail.webhooks.<a href="./src/resources/print-mail/webhooks.ts">delete</a>(id) -> WebhookDeleteResponse</code>
- <code title="get /print-mail/v1/webhooks/{id}/invocations">client.printMail.webhooks.<a href="./src/resources/print-mail/webhooks.ts">listInvocations</a>(id, { ...params }) -> WebhookInvocationsSkipLimit</code>

## Events

Types:

- <code><a href="./src/resources/print-mail/events.ts">Event</a></code>

Methods:

- <code title="get /print-mail/v1/events">client.printMail.events.<a href="./src/resources/print-mail/events.ts">list</a>({ ...params }) -> EventsSkipLimit</code>

## Letters

Types:
Expand All @@ -107,11 +149,12 @@ Types:
- <code><a href="./src/resources/print-mail/letters.ts">Letter</a></code>
- <code><a href="./src/resources/print-mail/letters.ts">LetterSize</a></code>
- <code><a href="./src/resources/print-mail/letters.ts">PlasticCard</a></code>
- <code><a href="./src/resources/print-mail/letters.ts">LetterCreateResponse</a></code>
- <code><a href="./src/resources/print-mail/letters.ts">LetterRetrieveURLResponse</a></code>

Methods:

- <code title="post /print-mail/v1/letters">client.printMail.letters.<a href="./src/resources/print-mail/letters.ts">create</a>({ ...params }) -> Letter</code>
- <code title="post /print-mail/v1/letters">client.printMail.letters.<a href="./src/resources/print-mail/letters.ts">create</a>({ ...params }) -> LetterCreateResponse</code>
- <code title="get /print-mail/v1/letters/{id}">client.printMail.letters.<a href="./src/resources/print-mail/letters.ts">retrieve</a>(id) -> Letter</code>
- <code title="get /print-mail/v1/letters">client.printMail.letters.<a href="./src/resources/print-mail/letters.ts">list</a>({ ...params }) -> LettersSkipLimit</code>
- <code title="delete /print-mail/v1/letters/{id}">client.printMail.letters.<a href="./src/resources/print-mail/letters.ts">delete</a>(id) -> Letter</code>
Expand All @@ -124,11 +167,12 @@ Methods:
Types:

- <code><a href="./src/resources/print-mail/postcards.ts">Postcard</a></code>
- <code><a href="./src/resources/print-mail/postcards.ts">PostcardCreateResponse</a></code>
- <code><a href="./src/resources/print-mail/postcards.ts">PostcardRetrieveURLResponse</a></code>

Methods:

- <code title="post /print-mail/v1/postcards">client.printMail.postcards.<a href="./src/resources/print-mail/postcards.ts">create</a>({ ...params }) -> Postcard</code>
- <code title="post /print-mail/v1/postcards">client.printMail.postcards.<a href="./src/resources/print-mail/postcards.ts">create</a>({ ...params }) -> PostcardCreateResponse</code>
- <code title="get /print-mail/v1/postcards/{id}">client.printMail.postcards.<a href="./src/resources/print-mail/postcards.ts">retrieve</a>(id) -> Postcard</code>
- <code title="get /print-mail/v1/postcards">client.printMail.postcards.<a href="./src/resources/print-mail/postcards.ts">list</a>({ ...params }) -> PostcardsSkipLimit</code>
- <code title="delete /print-mail/v1/postcards/{id}">client.printMail.postcards.<a href="./src/resources/print-mail/postcards.ts">delete</a>(id) -> Postcard</code>
Expand Down Expand Up @@ -176,17 +220,44 @@ Methods:
Types:

- <code><a href="./src/resources/print-mail/self-mailers.ts">SelfMailer</a></code>
- <code><a href="./src/resources/print-mail/self-mailers.ts">SelfMailerCreateResponse</a></code>
- <code><a href="./src/resources/print-mail/self-mailers.ts">SelfMailerRetrieveURLResponse</a></code>

Methods:

- <code title="post /print-mail/v1/self_mailers">client.printMail.selfMailers.<a href="./src/resources/print-mail/self-mailers.ts">create</a>({ ...params }) -> SelfMailer</code>
- <code title="post /print-mail/v1/self_mailers">client.printMail.selfMailers.<a href="./src/resources/print-mail/self-mailers.ts">create</a>({ ...params }) -> SelfMailerCreateResponse</code>
- <code title="get /print-mail/v1/self_mailers/{id}">client.printMail.selfMailers.<a href="./src/resources/print-mail/self-mailers.ts">retrieve</a>(id) -> SelfMailer</code>
- <code title="get /print-mail/v1/self_mailers">client.printMail.selfMailers.<a href="./src/resources/print-mail/self-mailers.ts">list</a>({ ...params }) -> SelfMailersSkipLimit</code>
- <code title="delete /print-mail/v1/self_mailers/{id}">client.printMail.selfMailers.<a href="./src/resources/print-mail/self-mailers.ts">delete</a>(id) -> SelfMailer</code>
- <code title="post /print-mail/v1/self_mailers/{id}/progressions">client.printMail.selfMailers.<a href="./src/resources/print-mail/self-mailers.ts">progress</a>(id) -> SelfMailer</code>
- <code title="get /print-mail/v1/self_mailers/{id}/url">client.printMail.selfMailers.<a href="./src/resources/print-mail/self-mailers.ts">retrieveURL</a>(id) -> SelfMailerRetrieveURLResponse</code>

## ReturnEnvelopes

Types:

- <code><a href="./src/resources/print-mail/return-envelopes/return-envelopes.ts">ReturnEnvelope</a></code>

Methods:

- <code title="post /print-mail/v1/return_envelopes">client.printMail.returnEnvelopes.<a href="./src/resources/print-mail/return-envelopes/return-envelopes.ts">create</a>({ ...params }) -> ReturnEnvelope</code>
- <code title="get /print-mail/v1/return_envelopes/{id}">client.printMail.returnEnvelopes.<a href="./src/resources/print-mail/return-envelopes/return-envelopes.ts">retrieve</a>(id) -> ReturnEnvelope</code>
- <code title="get /print-mail/v1/return_envelopes">client.printMail.returnEnvelopes.<a href="./src/resources/print-mail/return-envelopes/return-envelopes.ts">list</a>({ ...params }) -> ReturnEnvelopesSkipLimit</code>

### Orders

Types:

- <code><a href="./src/resources/print-mail/return-envelopes/orders.ts">ReturnEnvelopeOrder</a></code>

Methods:

- <code title="post /print-mail/v1/return_envelopes/{id}/orders">client.printMail.returnEnvelopes.orders.<a href="./src/resources/print-mail/return-envelopes/orders.ts">create</a>(id, { ...params }) -> ReturnEnvelopeOrder</code>
- <code title="get /print-mail/v1/return_envelopes/{id}/orders/{orderID}">client.printMail.returnEnvelopes.orders.<a href="./src/resources/print-mail/return-envelopes/orders.ts">retrieve</a>(orderID, { ...params }) -> ReturnEnvelopeOrder</code>
- <code title="get /print-mail/v1/return_envelopes/{id}/orders">client.printMail.returnEnvelopes.orders.<a href="./src/resources/print-mail/return-envelopes/orders.ts">list</a>(id, { ...params }) -> ReturnEnvelopeOrdersSkipLimit</code>
- <code title="delete /print-mail/v1/return_envelopes/{id}/orders/{orderID}">client.printMail.returnEnvelopes.orders.<a href="./src/resources/print-mail/return-envelopes/orders.ts">cancel</a>(orderID, { ...params }) -> ReturnEnvelopeOrder</code>
- <code title="post /print-mail/v1/return_envelopes/{id}/orders/{orderID}/fills">client.printMail.returnEnvelopes.orders.<a href="./src/resources/print-mail/return-envelopes/orders.ts">fill</a>(orderID, { ...params }) -> ReturnEnvelopeOrder</code>

## Campaigns

Types:
Expand Down Expand Up @@ -314,20 +385,17 @@ Methods:

Types:

- <code><a href="./src/resources/print-mail/snap-packs.ts">SnapPack</a></code>
- <code><a href="./src/resources/print-mail/snap-packs.ts">SnapPackCreateResponse</a></code>
- <code><a href="./src/resources/print-mail/snap-packs.ts">SnapPackRetrieveResponse</a></code>
- <code><a href="./src/resources/print-mail/snap-packs.ts">SnapPackListResponse</a></code>
- <code><a href="./src/resources/print-mail/snap-packs.ts">SnapPackDeleteResponse</a></code>
- <code><a href="./src/resources/print-mail/snap-packs.ts">SnapPackProgressionsResponse</a></code>
- <code><a href="./src/resources/print-mail/snap-packs.ts">SnapPackRetrieveCapabilitiesResponse</a></code>

Methods:

- <code title="post /print-mail/v1/snap_packs">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">create</a>({ ...params }) -> SnapPackCreateResponse</code>
- <code title="get /print-mail/v1/snap_packs/{id}">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">retrieve</a>(id) -> SnapPackRetrieveResponse</code>
- <code title="get /print-mail/v1/snap_packs">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">list</a>({ ...params }) -> SnapPackListResponsesSkipLimit</code>
- <code title="delete /print-mail/v1/snap_packs/{id}">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">delete</a>(id) -> SnapPackDeleteResponse</code>
- <code title="post /print-mail/v1/snap_packs/{id}/progressions">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">progressions</a>(id) -> SnapPackProgressionsResponse</code>
- <code title="get /print-mail/v1/snap_packs/{id}">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">retrieve</a>(id) -> SnapPack</code>
- <code title="get /print-mail/v1/snap_packs">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">list</a>({ ...params }) -> SnapPacksSkipLimit</code>
- <code title="delete /print-mail/v1/snap_packs/{id}">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">delete</a>(id) -> SnapPack</code>
- <code title="post /print-mail/v1/snap_packs/{id}/progressions">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">progressions</a>(id) -> SnapPack</code>
- <code title="get /print-mail/v1/snap_packs/capabilities">client.printMail.snapPacks.<a href="./src/resources/print-mail/snap-packs.ts">retrieveCapabilities</a>({ ...params }) -> SnapPackRetrieveCapabilitiesResponse</code>

## TargetedListBuilds
Expand Down
4 changes: 4 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

errors=()

if [ -z "${NPM_TOKEN}" ]; then
errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
Expand Down
12 changes: 2 additions & 10 deletions bin/publish-npm
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

set -eux

if [[ ${NPM_TOKEN:-} ]]; then
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
elif [[ ! ${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-} ]]; then
echo "ERROR: NPM_TOKEN must be set if not running in a Github Action with id-token permission"
exit 1
fi
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"

pnpm build
cd dist
Expand Down Expand Up @@ -62,8 +57,5 @@ else
TAG="latest"
fi

# Install OIDC compatible npm version
npm install --prefix ../oidc/ npm@11.6.2

# Publish with the appropriate tag
pnpm publish --npm-path "$(cd ../ && pwd)/oidc/node_modules/.bin/npm" --no-git-checks --tag "$TAG"
pnpm publish --no-git-checks --tag "$TAG"
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postgrid-node",
"version": "0.6.1",
"version": "0.7.0",
"description": "The official TypeScript library for the PostGrid API",
"author": "PostGrid <support@postgrid.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -43,7 +43,7 @@
"publint": "^0.2.12",
"ts-jest": "^29.1.0",
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"tslib": "^2.8.1",
"typescript": "5.8.3",
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading