Skip to content

Commit

Permalink
Added TypeScript type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
ip2location committed Dec 13, 2021
1 parent 1e194a7 commit 8497035
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ip2location-nodejs",
"version": "9.0.0",
"version": "9.1.0",
"description": "IP2Location geolocation component",
"keywords": [
"ip2location",
Expand All @@ -15,9 +15,11 @@
"files": [
"src/ip2location.js",
"src/test.js",
"src/ip2location.d.ts",
"./README.md"
],
"main": "src/ip2location.js",
"types": "src/ip2location.d.ts",
"license": "MIT",
"dependencies": {
"big-integer": "^1.6.47"
Expand Down
100 changes: 100 additions & 0 deletions src/ip2location.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
export class IP2Location {
readRow(readBytes: any, position: any): any;
readBin(readBytes: any, position: any, readType: any, isBigInt: any): any;
read8(position: any): any;
read32(position: any, isBigInt: any): any;
read32Row(position: any, buffer: any): any;
read32Or128(position: any, ipType: any): any;
read128(position: any): any;
readFloatRow(position: any, buffer: any): any;
readStr(position: any): any;
loadBin(): boolean;
open(binPath: any): void;
close(): 0 | -1;
geoQueryData(myIP: any, ipType: any, data: any, mode: any): void;
geoQuery(myIP: any, mode: any): {
ip: string;
ipNo: string;
countryShort: string;
countryLong: string;
region: string;
city: string;
isp: string;
domain: string;
zipCode: string;
latitude: string;
longitude: string;
timeZone: string;
netSpeed: string;
iddCode: string;
areaCode: string;
weatherStationCode: string;
weatherStationName: string;
mcc: string;
mnc: string;
mobileBrand: string;
elevation: string;
usageType: string;
addressType: string;
category: string;
};
getAPIVersion(): string;
getPackageVersion(): number;
getDatabaseVersion(): string;
getCountryShort(myIP: any): string;
getCountryLong(myIP: any): string;
getRegion(myIP: any): string;
getCity(myIP: any): string;
getISP(myIP: any): string;
getLatitude(myIP: any): string;
getLongitude(myIP: any): string;
getDomain(myIP: any): string;
getZIPCode(myIP: any): string;
getTimeZone(myIP: any): string;
getNetSpeed(myIP: any): string;
getIDDCode(myIP: any): string;
getAreaCode(myIP: any): string;
getWeatherStationCode(myIP: any): string;
getWeatherStationName(myIP: any): string;
getMCC(myIP: any): string;
getMNC(myIP: any): string;
getMobileBrand(myIP: any): string;
getElevation(myIP: any): string;
getUsageType(myIP: any): string;
getAddressType(myIP: any): string;
getCategory(myIP: any): string;
getAll(myIP: any): {
ip: string;
ipNo: string;
countryShort: string;
countryLong: string;
region: string;
city: string;
isp: string;
domain: string;
zipCode: string;
latitude: string;
longitude: string;
timeZone: string;
netSpeed: string;
iddCode: string;
areaCode: string;
weatherStationCode: string;
weatherStationName: string;
mcc: string;
mnc: string;
mobileBrand: string;
elevation: string;
usageType: string;
addressType: string;
category: string;
};
#private;
}
export class IP2LocationWebService {
open(apiKey: any, apiPackage: any, useSSL?: boolean): void;
checkParams(): void;
lookup(myIP: any, addOn: any, lang: any, callback: any): void;
getCredit(callback: any): void;
#private;
}
2 changes: 1 addition & 1 deletion src/ip2location.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var bigInt = require("big-integer");
var https = require("https");

// For BIN queries
const VERSION = "9.0.0";
const VERSION = "9.1.0";
const MAX_INDEX = 65536;
const COUNTRY_POSITION = [
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,
Expand Down

0 comments on commit 8497035

Please sign in to comment.