Skip to content

Commit 15bbbee

Browse files
committed
Update API docs links and update code examples to use ES6 syntax
1 parent 4ef1bd5 commit 15bbbee

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is the official node wrapper for the Emailable API.
88

99
## Documentation
1010

11-
See the [Node API docs](https://emailable.com/docs/api/?javascript).
11+
See the [Node API docs](https://emailable.com/docs/api/emails/?code_language=javascript).
1212

1313
## Installation
1414

@@ -33,49 +33,49 @@ authentication. API keys can be created and managed in the
3333
An API key can be set globally for the Emailable client:
3434

3535
```javascript
36-
// require with API key
37-
var emailable = require('emailable')('your_api_key')
36+
// Global: Common JS import
37+
const emailable = require('emailable')('YOUR_API_KEY');
3838

39-
// ES6 import
39+
// Global: ES6 import
4040
import Emailable from 'emailable';
41-
const emailable = Emailable('your_api_key');
41+
const emailable = Emailable('YOUR_API_KEY');
4242
```
4343

4444
Or, you can specify an `apiKey` or an `accessToken` with each request:
4545

4646
```javascript
4747
// set api_key at request time
48-
emailable.verify({ apiKey: 'your_api_key' })
48+
emailable.verify({ apiKey: 'YOUR_API_KEY' })
4949

5050
// set access_token at request time
51-
emailable.verify({ accessToken: 'your_api_key' })
51+
emailable.verify({ accessToken: 'YOUR_API_KEY' })
5252
```
5353

5454
### Verification
5555

5656
```javascript
5757
// verify an email address
5858
emailable.verify('jarrett@emailable.com')
59-
.then(function (response) {
59+
.then((response) => {
6060
console.log(response);
6161
})
62-
.catch(function (error) {
62+
.catch((error) => {
6363
console.log(error);
6464
});
6565
```
6666

6767
#### Additional options
6868

6969
You can also pass any of the additional
70-
[options](https://emailable.com/docs/api?javascript#verify-an-email)
70+
[options](https://emailable.com/docs/api/emails/?code_language=javascript#verify-an-email)
7171
as a second parameter to `verify`.
7272

7373
```javascript
7474
emailable.verify('jarrett@emailable.com', { timeout: 10 })
75-
.then(function (response) {
75+
.then((response) => {
7676
console.log(response);
7777
})
78-
.catch(function (error) {
78+
.catch((error) => {
7979
console.log(error);
8080
});
8181
```
@@ -100,22 +100,23 @@ allocation within a 5 minute window.
100100
#### Start a batch
101101

102102
```javascript
103-
var emails = ['jarrett@emailable.com', 'support@emailable.com', ...]
103+
const emails = ['jarrett@emailable.com', 'support@emailable.com', ...];
104+
104105
emailable.batches.verify(emails)
105-
.then(function (response) {
106+
.then((response) => {
106107
console.log(response.id);
107108
});
108109
```
109110

110111
##### Additional options
111112

112113
You can also pass any of the additional
113-
[options](https://emailable.com/docs/api?javascript#verify-a-batch-of-emails)
114+
[options](https://emailable.com/docs/api/emails/?code_language=javascript#verify-a-batch-of-emails)
114115
as a second parameter to `verify`.
115116

116117
```javascript
117-
emailable.batches.verify(emails, { url: 'https://emailable.com/' }).
118-
then(function (response) {
118+
emailable.batches.verify(emails, { url: 'https://emailable.com/' })
119+
.then((response) => {
119120
console.log(response.id);
120121
});
121122
```
@@ -126,9 +127,10 @@ Calling `batches.status` with the batch id will return the batch's status.
126127
This will also return the results once the batch is complete.
127128

128129
```javascript
129-
var id = '5cfcbfdeede34200693c4319'
130+
const id = '5cfcbfdeede34200693c4319';
131+
130132
emailable.batches.status(id)
131-
.then(function (response) {
133+
.then((response) => {
132134
console.log(response);
133135
});
134136
```

0 commit comments

Comments
 (0)