Skip to content

Commit

Permalink
Improved README formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
verifalia committed Oct 16, 2021
1 parent f87ca65 commit 56aa2cb
Showing 1 changed file with 58 additions and 58 deletions.
116 changes: 58 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ Using this loading method you can use the features of this library through the `
```javascript
define(["verifalia"], function (verifaliaModule) {
const verifalia = new verifaliaModule.VerifaliaRestClient({
username: 'samantha',
password: '42istheanswer'
});
username: 'samantha',
password: '42istheanswer'
});

return { };
return { };
});
```

Expand Down Expand Up @@ -140,8 +140,8 @@ Once you have your Verifalia credentials at hand, use them while creating a new

```ts
const verifalia = new VerifaliaRestClient({
username: 'username',
password: 'password'
username: 'username',
password: 'password'
});
```

Expand All @@ -153,7 +153,7 @@ A browser app key is essentially a username you can use while authenticating aga

```ts
const verifalia = new VerifaliaRestClient({
username: 'YOUR-BROWSER-APP-KEY-HERE'
username: 'YOUR-BROWSER-APP-KEY-HERE'
});
```

Expand Down Expand Up @@ -205,17 +205,17 @@ And here is the same example, using the promise callback syntax:
```ts
verifalia
.emailValidations
.submit('[email protected]', true)
.then(validation => {
// At this point the address has been validated: let's print
// its email validation result to the console.
.submit('[email protected]', true)
.then(validation => {
// At this point the address has been validated: let's print
// its email validation result to the console.

const entry = validation.entries[0];
console.log(entry.inputData, entry.classification, entry.status);
const entry = validation.entries[0];
console.log(entry.inputData, entry.classification, entry.status);

// Prints out something like:
// [email protected] Deliverable Success
});
// Prints out something like:
// [email protected] Deliverable Success
});
```

## How to validate a list of email addresses ##
Expand All @@ -230,10 +230,10 @@ Here is how to submit some email addresses for validation, without waiting for t
const validation = await verifalia
.emailValidations
.submit([{
"[email protected]",
"[email protected]",
"[email protected]"
}]);
"[email protected]",
"[email protected]",
"[email protected]"
}]);

console.log(`Job Id: ${validation.overview.id}`);
console.log(`Status: ${validation.overview.status}`);
Expand All @@ -250,17 +250,17 @@ And here is the promise callback syntax:
verifalia
.emailValidations
.submit([{
"[email protected]",
"[email protected]",
"[email protected]"
}])
.then(validation => {
console.log(`Job Id: ${validation.overview.id}`);
console.log(`Status: ${validation.overview.status}`);

// 'Job Id: 290b5146-eeac-4a2b-a9c1-61c7e715f2e9'
// 'Status InProgress'
});
"[email protected]",
"[email protected]",
"[email protected]"
}])
.then(validation => {
console.log(`Job Id: ${validation.overview.id}`);
console.log(`Status: ${validation.overview.status}`);

// 'Job Id: 290b5146-eeac-4a2b-a9c1-61c7e715f2e9'
// 'Status InProgress'
});
```
Expand Down Expand Up @@ -328,10 +328,10 @@ const validation = await verifalia
.get('290b5146-eeac-4a2b-a9c1-61c7e715f2e9');

if (validation.overview.status === ValidationStatus.Completed) {
// validation.entries will have the validation results!
// validation.entries will have the validation results!
}
else {
// What about having a coffee?
// What about having a coffee?
}
```
Expand All @@ -340,15 +340,15 @@ And using the promise callback syntax:
```ts
verifalia
.emailValidations
.get('290b5146-eeac-4a2b-a9c1-61c7e715f2e9')
.then(validation => {
.get('290b5146-eeac-4a2b-a9c1-61c7e715f2e9')
.then(validation => {
if (validation.overview.status === ValidationStatus.Completed) {
// validation.entries will have the validation results!
// validation.entries will have the validation results!
}
else {
// What about having a coffee?
}
});
// What about having a coffee?
}
});
```
And here is how to request the same job, asking the library to automatically wait for us until the job is completed (that is, _joining_ the job). Here with the async/await syntax:
Expand All @@ -364,10 +364,10 @@ And here using the promise callback syntax:
```ts
verifalia
.emailValidations
.get('290b5146-eeac-4a2b-a9c1-61c7e715f2e9', true)
.then(validation => {
// TODO: Let's party!
});
.get('290b5146-eeac-4a2b-a9c1-61c7e715f2e9', true)
.then(validation => {
// TODO: Let's party!
});
```
### How export a human-readable report of the verification result ###
Expand All @@ -381,9 +381,9 @@ Here is an example showing how to export a completed email verification job as a
import { MimeContentType_ExcelXlsx } from 'verifalia/node/esm/index.mjs';

(
await verifalia
.emailValidations
.export('dc21630a-6773-4bd0-b248-15e8b50c0d3e', MimeContentType_ExcelXlsx)
await verifalia
.emailValidations
.export('dc21630a-6773-4bd0-b248-15e8b50c0d3e', MimeContentType_ExcelXlsx)
).pipe(fs.createWriteStream('/home/lbanfi/my-list.xls'))
```
Expand All @@ -399,8 +399,8 @@ import { MimeContentType_TextCsv } from 'verifalia';

const target = document.getElementByID('my-iframe');
const exportedData = await verifalia
.emailValidations
.export('dc21630a-6773-4bd0-b248-15e8b50c0d3e', MimeContentType_TextCsv);
.emailValidations
.export('dc21630a-6773-4bd0-b248-15e8b50c0d3e', MimeContentType_TextCsv);

target.src = exportedData.toBlobURL(MimeContentType_TextCsv);
```
Expand All @@ -421,10 +421,10 @@ And here is the same example using the promise callback syntax:
```ts
verifalia
.emailValidations
.delete(validation.id)
.then(() => {
// ...
});
.delete(validation.id)
.then(() => {
// ...
});
```
Once deleted, a job is gone and there is no way to retrieve its email validation(s).
Expand Down Expand Up @@ -463,14 +463,14 @@ Here is how to retrieve the daily credits consumption for a certain period:
const dailyUsages = verifalia
.credits
.listDailyUsages({
// from, to
dateFilter = new DateBetweenPredicate(new Date('2021-10-09'), new Date('2021-11-08'))
});
// from, to
dateFilter = new DateBetweenPredicate(new Date('2021-10-09'), new Date('2021-11-08'))
});

for await (const dailyUsage of dailyUsages) {
console.log(dailyUsage.date);
console.log('\tCredit packs', dailyUsage.creditPacks);
console.log('\tFree daily credits', dailyUsage.freeCredits);
console.log(dailyUsage.date);
console.log('\tCredit packs', dailyUsage.creditPacks);
console.log('\tFree daily credits', dailyUsage.freeCredits);
}

// Prints out something like:
Expand Down

0 comments on commit 56aa2cb

Please sign in to comment.