@apiverve/ipdemographics 1.1.14 → 1.2.0

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.
Files changed (3) hide show
  1. package/README.md +9 -4
  2. package/index.d.ts +38 -19
  3. package/package.json +5 -6
package/README.md CHANGED
@@ -60,7 +60,7 @@ Using the API is simple. All you have to do is make a request. The API will retu
60
60
 
61
61
  ```javascript
62
62
  var query = {
63
- ip: "8.8.8.8"
63
+ ip: "173.172.81.20"
64
64
  };
65
65
 
66
66
  api.execute(query, function (error, data) {
@@ -80,7 +80,7 @@ You can also use promises to make requests. The API returns a promise that you c
80
80
 
81
81
  ```javascript
82
82
  var query = {
83
- ip: "8.8.8.8"
83
+ ip: "173.172.81.20"
84
84
  };
85
85
 
86
86
  api.execute(query)
@@ -101,7 +101,7 @@ You can also use async/await to make requests. The API returns a promise that yo
101
101
  ```javascript
102
102
  async function makeRequest() {
103
103
  var query = {
104
- ip: "8.8.8.8"
104
+ ip: "173.172.81.20"
105
105
  };
106
106
 
107
107
  try {
@@ -144,7 +144,12 @@ async function makeRequest() {
144
144
  "unemploymentRate": 3.2,
145
145
  "homeOwnershipRate": 45.6
146
146
  },
147
- "acsYear": 2022
147
+ "acsYear": 2022,
148
+ "formatted": {
149
+ "medianHouseholdIncome": "$142,567",
150
+ "perCapitaIncome": "$78,234",
151
+ "medianHomeValue": "$1,875,000"
152
+ }
148
153
  }
149
154
  }
150
155
  ```
package/index.d.ts CHANGED
@@ -4,42 +4,61 @@ declare module '@apiverve/ipdemographics' {
4
4
  secure?: boolean;
5
5
  }
6
6
 
7
+ /**
8
+ * Describes fields the current plan does not unlock. Locked fields arrive as null
9
+ * in `data`; `locked_fields` names them, using dot paths for nested fields.
10
+ * Absent when the plan unlocks everything.
11
+ */
12
+ export interface PremiumInfo {
13
+ message: string;
14
+ upgrade_url: string;
15
+ locked_fields: string[];
16
+ }
17
+
7
18
  export interface ipdemographicsResponse {
8
19
  status: string;
9
20
  error: string | null;
10
21
  data: IPDemographicsData;
11
22
  code?: number;
23
+ premium?: PremiumInfo;
12
24
  }
13
25
 
14
26
 
15
27
  interface IPDemographicsData {
16
- ip: string;
28
+ ip: null | string;
17
29
  location: Location;
18
30
  demographics: Demographics;
19
- acsYear: number;
31
+ acsYear: number | null;
32
+ formatted: Formatted;
20
33
  }
21
34
 
22
35
  interface Demographics {
23
- population: number;
24
- medianAge: number;
25
- medianHouseholdIncome: number;
26
- perCapitaIncome: number;
27
- medianHomeValue: number;
28
- collegeEducatedPct: number;
29
- unemploymentRate: number;
30
- homeOwnershipRate: number;
36
+ population: number | null;
37
+ medianAge: number | null;
38
+ medianHouseholdIncome: number | null;
39
+ perCapitaIncome: number | null;
40
+ medianHomeValue: number | null;
41
+ collegeEducatedPct: number | null;
42
+ unemploymentRate: number | null;
43
+ homeOwnershipRate: number | null;
44
+ }
45
+
46
+ interface Formatted {
47
+ medianHouseholdIncome: null | string;
48
+ perCapitaIncome: null | string;
49
+ medianHomeValue: null | string;
31
50
  }
32
51
 
33
52
  interface Location {
34
- zip: string;
35
- city: string;
36
- state: string;
37
- stateCode: string;
38
- country: string;
39
- countryCode: string;
40
- latitude: number;
41
- longitude: number;
42
- timezone: string;
53
+ zip: null | string;
54
+ city: null | string;
55
+ state: null | string;
56
+ stateCode: null | string;
57
+ country: null | string;
58
+ countryCode: null | string;
59
+ latitude: number | null;
60
+ longitude: number | null;
61
+ timezone: null | string;
43
62
  }
44
63
 
45
64
  export default class ipdemographicsWrapper {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@apiverve/ipdemographics",
3
- "version": "1.1.14",
3
+ "version": "1.2.0",
4
4
  "description": "IP Demographics combines IP geolocation with Census demographic data to provide demographic information for any IP address. Get location, income, education, and housing data based on the IP's geographic location.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "sideEffects": false,
8
8
  "engines": {
9
- "node": ">=14.0.0"
9
+ "node": ">=18.0.0"
10
10
  },
11
11
  "files": [
12
12
  "index.js",
@@ -23,7 +23,7 @@
23
23
  "directory": "npm"
24
24
  },
25
25
  "keywords": [
26
- ""
26
+ "ip demographics", "ip location demographics", "geolocation demographics", "ip to demographics", "visitor demographics"
27
27
  ],
28
28
  "author": {
29
29
  "name": "APIVerve",
@@ -41,8 +41,7 @@
41
41
  "dotenv": "^16.4.7"
42
42
  },
43
43
  "dependencies": {
44
- "node-fetch": "^3.3.2",
45
- "promise": "^8.3.0",
46
- "axios": "1.13.2"
44
+ "axios": "1.13.2",
45
+ "form-data": "^4.0.1"
47
46
  }
48
47
  }