Migrating from 1.x to 2.x version

Igor Balos edited this page Oct 31, 2018 · 7 revisions

There has been a lot of improvements in version 2 of the library which we migrated to Typescript. However migration to it should be pretty easy.

All you would need to do is migrate clients if you would like to. In the latest version of the library, we also provide backward compatibility.

Version 1.x clients initialization

let postmark = require("postmark");

let serverToken = "xxxxxx-xxxxxx-xxxxx-xxxxxx";
let accountToken = "yyyyyy-yyyyy-yyyyy-yyyyyy"

let client = new postmark.Client(serverToken);
let accountClient = new postmark.AdminClient(accountToken);

Version 2.x clients initialization

let postmark = require("postmark");

let serverToken = "xxxxxx-xxxxxx-xxxxx-xxxxxx";
let accountToken = "yyyyyy-yyyyy-yyyyy-yyyyyy"

let client = new postmark.ServerClient(serverToken);
let accountClient = new postmark.AccountClient(accountToken);

From then on, you should be good to go. Most of the things will work pretty much the same. For additional details about each method, you can check out code examples at wiki and the detailed typescript documentation which will guide you even further.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.