dymo-api 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
1
|
# Official Dymo API Library for Node.
|
|
2
2
|
|
|
3
|
-
You can see the library documentation by clicking [here](https://docs.tpeoficial.com/docs/dymo-api/getting-started/libraries?ch-pg=r-dm-node).
|
|
3
|
+
You can see the library documentation by clicking [here](https://docs.tpeoficial.com/docs/dymo-api/getting-started/libraries?ch-pg=r-dm-node).
|
|
4
|
+
|
|
5
|
+
#### Installation
|
|
6
|
+
|
|
7
|
+
Use one of the following commands to install **Dymo API** in your `TS`/`JS` project.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i dymo-api
|
|
11
|
+
|
|
12
|
+
# or
|
|
13
|
+
|
|
14
|
+
pnpm i dymo-api
|
|
15
|
+
|
|
16
|
+
# or
|
|
17
|
+
|
|
18
|
+
yarn add dymo-api
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### Authenticating ourselves on the client with the API Key
|
|
22
|
+
|
|
23
|
+
[Get my free API Key](https://tpe.li/new-api-key?ch-pg=gh-dmapi-node-rd-step)
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import DymoAPI from "dymo-api";
|
|
27
|
+
|
|
28
|
+
const dymoClient = new DymoAPI({
|
|
29
|
+
// https://tpe.li/new-api-key
|
|
30
|
+
apiKey: "PRIVATE_TOKEN_HERE"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### Validating all data at once
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import DymoAPI from "dymo-api";
|
|
39
|
+
|
|
40
|
+
const dymoClient = new DymoAPI({
|
|
41
|
+
// https://tpe.li/new-api-key
|
|
42
|
+
apiKey: "PRIVATE_TOKEN_HERE"
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
(async () => {
|
|
46
|
+
const response = await dymoClient.isValidData({
|
|
47
|
+
url: "https://test.com/test",
|
|
48
|
+
email: "test@test.com",
|
|
49
|
+
phone: "+34617509462",
|
|
50
|
+
domain: "test.com",
|
|
51
|
+
creditCard: {
|
|
52
|
+
pan: "5110929780543845",
|
|
53
|
+
expirationDate: "01/2030",
|
|
54
|
+
cvv: "123"
|
|
55
|
+
},
|
|
56
|
+
ip: "52.94.236.248",
|
|
57
|
+
wallet: "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
|
|
58
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"
|
|
59
|
+
})
|
|
60
|
+
})();
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Validating Email with Rules
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import DymoAPI from "dymo-api";
|
|
67
|
+
|
|
68
|
+
const dymoClient = new DymoAPI({
|
|
69
|
+
// https://tpe.li/new-api-key
|
|
70
|
+
apiKey: "PRIVATE_TOKEN_HERE",
|
|
71
|
+
rules: {
|
|
72
|
+
email: {
|
|
73
|
+
// These are the default rules defined for email validation.
|
|
74
|
+
deny: ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
(async () => {
|
|
80
|
+
const decision = await dymoClient.isValidEmail("user@example.com");
|
|
81
|
+
|
|
82
|
+
if (!decision.allow) throw new Error(`Email not allowed. Reason: ${decision.reasons[0]}`);
|
|
83
|
+
})();
|
|
84
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dymo-api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.05",
|
|
4
4
|
"description": "Flow system for Dymo API.",
|
|
5
5
|
"main": "dist/cjs/dymo-api.js",
|
|
6
6
|
"module": "dist/esm/dymo-api.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "rimraf dist && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && node ./scripts/rename.js",
|
|
27
27
|
"start": "ts-node src/dymo-api.ts",
|
|
28
|
-
"prepublishOnly": "npm run build",
|
|
28
|
+
"prepublishOnly": "npm run test && npm run build",
|
|
29
29
|
"test": "jest --max-old-space-size=4096",
|
|
30
30
|
"test:watch": "jest --watch --max-old-space-size=4096"
|
|
31
31
|
},
|