Skip to content

Commit 8497035

Browse files
committed
Added TypeScript type declarations
1 parent 1e194a7 commit 8497035

File tree

3 files changed

+104
-2
lines changed

3 files changed

+104
-2
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ip2location-nodejs",
3-
"version": "9.0.0",
3+
"version": "9.1.0",
44
"description": "IP2Location geolocation component",
55
"keywords": [
66
"ip2location",
@@ -15,9 +15,11 @@
1515
"files": [
1616
"src/ip2location.js",
1717
"src/test.js",
18+
"src/ip2location.d.ts",
1819
"./README.md"
1920
],
2021
"main": "src/ip2location.js",
22+
"types": "src/ip2location.d.ts",
2123
"license": "MIT",
2224
"dependencies": {
2325
"big-integer": "^1.6.47"

src/ip2location.d.ts

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
export class IP2Location {
2+
readRow(readBytes: any, position: any): any;
3+
readBin(readBytes: any, position: any, readType: any, isBigInt: any): any;
4+
read8(position: any): any;
5+
read32(position: any, isBigInt: any): any;
6+
read32Row(position: any, buffer: any): any;
7+
read32Or128(position: any, ipType: any): any;
8+
read128(position: any): any;
9+
readFloatRow(position: any, buffer: any): any;
10+
readStr(position: any): any;
11+
loadBin(): boolean;
12+
open(binPath: any): void;
13+
close(): 0 | -1;
14+
geoQueryData(myIP: any, ipType: any, data: any, mode: any): void;
15+
geoQuery(myIP: any, mode: any): {
16+
ip: string;
17+
ipNo: string;
18+
countryShort: string;
19+
countryLong: string;
20+
region: string;
21+
city: string;
22+
isp: string;
23+
domain: string;
24+
zipCode: string;
25+
latitude: string;
26+
longitude: string;
27+
timeZone: string;
28+
netSpeed: string;
29+
iddCode: string;
30+
areaCode: string;
31+
weatherStationCode: string;
32+
weatherStationName: string;
33+
mcc: string;
34+
mnc: string;
35+
mobileBrand: string;
36+
elevation: string;
37+
usageType: string;
38+
addressType: string;
39+
category: string;
40+
};
41+
getAPIVersion(): string;
42+
getPackageVersion(): number;
43+
getDatabaseVersion(): string;
44+
getCountryShort(myIP: any): string;
45+
getCountryLong(myIP: any): string;
46+
getRegion(myIP: any): string;
47+
getCity(myIP: any): string;
48+
getISP(myIP: any): string;
49+
getLatitude(myIP: any): string;
50+
getLongitude(myIP: any): string;
51+
getDomain(myIP: any): string;
52+
getZIPCode(myIP: any): string;
53+
getTimeZone(myIP: any): string;
54+
getNetSpeed(myIP: any): string;
55+
getIDDCode(myIP: any): string;
56+
getAreaCode(myIP: any): string;
57+
getWeatherStationCode(myIP: any): string;
58+
getWeatherStationName(myIP: any): string;
59+
getMCC(myIP: any): string;
60+
getMNC(myIP: any): string;
61+
getMobileBrand(myIP: any): string;
62+
getElevation(myIP: any): string;
63+
getUsageType(myIP: any): string;
64+
getAddressType(myIP: any): string;
65+
getCategory(myIP: any): string;
66+
getAll(myIP: any): {
67+
ip: string;
68+
ipNo: string;
69+
countryShort: string;
70+
countryLong: string;
71+
region: string;
72+
city: string;
73+
isp: string;
74+
domain: string;
75+
zipCode: string;
76+
latitude: string;
77+
longitude: string;
78+
timeZone: string;
79+
netSpeed: string;
80+
iddCode: string;
81+
areaCode: string;
82+
weatherStationCode: string;
83+
weatherStationName: string;
84+
mcc: string;
85+
mnc: string;
86+
mobileBrand: string;
87+
elevation: string;
88+
usageType: string;
89+
addressType: string;
90+
category: string;
91+
};
92+
#private;
93+
}
94+
export class IP2LocationWebService {
95+
open(apiKey: any, apiPackage: any, useSSL?: boolean): void;
96+
checkParams(): void;
97+
lookup(myIP: any, addOn: any, lang: any, callback: any): void;
98+
getCredit(callback: any): void;
99+
#private;
100+
}

src/ip2location.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var bigInt = require("big-integer");
44
var https = require("https");
55

66
// For BIN queries
7-
const VERSION = "9.0.0";
7+
const VERSION = "9.1.0";
88
const MAX_INDEX = 65536;
99
const COUNTRY_POSITION = [
1010
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,

0 commit comments

Comments
 (0)