-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from SparkPost/wip-2.0.0
Releasing version 2.0.0
- Loading branch information
Showing
167 changed files
with
4,033 additions
and
4,271 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "sparkpost/api", | ||
"globals": { | ||
"Promise": true | ||
} | ||
} |
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,6 +1,7 @@ | ||
{ | ||
"node" : true, | ||
"es3" : false, | ||
"esnext" : true, | ||
"strict" : true, | ||
"curly" : true, | ||
"eqeqeq" : true, | ||
|
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,12 +1,10 @@ | ||
language: node_js | ||
node_js: | ||
- '4.1' | ||
- '4.0' | ||
- '0.12' | ||
- '0.10' | ||
before_install: npm install -g grunt-cli | ||
install: npm install | ||
script: "npm run-script ci" | ||
- '4' | ||
- '5' | ||
- '6' | ||
after_success: | ||
- npm run coveralls | ||
notifications: | ||
slack: | ||
secure: dsz+D/TuylEi+6zqdB5dVqyMlpbpafaBBcAwYIijTK6LuG8KdIdGNSFVX1ro6o3bJFwMvtfxNeK1eFrMy8l6VHZQL0dkXWRmCl/pxLhEntUiYTDwDOtiqy1QLZtv5AqtsdSr1qLiOJtgF6gXk66xipnV2UzjLVVoxzSrdOSnX4U= |
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 was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Async Handling | ||
|
||
Callbacks and promises living together... MASS HYSTERIA. Or not! This library handles both of your favorite async strategies. | ||
|
||
### Promises | ||
|
||
All our library methods return promises, so if you're a promise-fan, just do what you normally do. | ||
|
||
```javascript | ||
let client = new SparkPost(key); | ||
|
||
client.templates.get(id) | ||
.then((data) => { | ||
// this the full API response body | ||
}) | ||
.catch((err) => { | ||
// handle the sad error | ||
}); | ||
``` | ||
|
||
### Callbacks | ||
|
||
If you're more of a callbacker, that works too. Pass a callback as the last argument and it'll be handled like a regular, error-first callback. | ||
|
||
```javascript | ||
let client = new SparkPost(key); | ||
|
||
client.templates.get(id, (err, data) => { | ||
if (err) { | ||
// handle the sad error | ||
return; | ||
} | ||
|
||
// this is the full API response body | ||
}); | ||
``` |
Oops, something went wrong.