ipwho 1.0.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.
@@ -0,0 +1,17 @@
1
+ interface IPWhoResponse {
2
+ success: boolean;
3
+ message?: string;
4
+ data?: any;
5
+ [key: string]: any;
6
+ }
7
+
8
+ declare class IPWho {
9
+ private apiKey;
10
+ private baseUrl;
11
+ constructor(apiKey: string);
12
+ private fetcher;
13
+ getIp(ip: string): Promise<IPWhoResponse>;
14
+ getMe(): Promise<IPWhoResponse>;
15
+ }
16
+
17
+ export { IPWho, type IPWhoResponse };
@@ -0,0 +1,17 @@
1
+ interface IPWhoResponse {
2
+ success: boolean;
3
+ message?: string;
4
+ data?: any;
5
+ [key: string]: any;
6
+ }
7
+
8
+ declare class IPWho {
9
+ private apiKey;
10
+ private baseUrl;
11
+ constructor(apiKey: string);
12
+ private fetcher;
13
+ getIp(ip: string): Promise<IPWhoResponse>;
14
+ getMe(): Promise<IPWhoResponse>;
15
+ }
16
+
17
+ export { IPWho, type IPWhoResponse };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(s,e)=>{for(var r in e)a(s,r,{get:e[r],enumerable:!0})},g=(s,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of h(e))!c.call(s,t)&&t!==r&&a(s,t,{get:()=>e[t],enumerable:!(i=p(e,t))||i.enumerable});return s};var y=s=>g(a({},"__esModule",{value:!0}),s);var u={};f(u,{IPWho:()=>n});module.exports=y(u);var n=class{constructor(e){this.baseUrl="https://api.ipwho.org";if(!e)throw new Error("API Key is required");this.apiKey=e}async fetcher(e){let r=e.includes("?")?"&":"?",i=`${this.baseUrl}${e}${r}apiKey=${this.apiKey}`,o=await(await fetch(i,{headers:{"X-API-Key":this.apiKey,"User-Agent":"ipwho-node-sdk/1.0.0"}})).json();if(!o.success)throw new Error(o.message||"Request failed");return o.data}async getIp(e){return this.fetcher(`/ip/${e}`)}async getMe(){return this.fetcher("/me")}};0&&(module.exports={IPWho});
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var r=class{constructor(e){this.baseUrl="https://api.ipwho.org";if(!e)throw new Error("API Key is required");this.apiKey=e}async fetcher(e){let t=e.includes("?")?"&":"?",i=`${this.baseUrl}${e}${t}apiKey=${this.apiKey}`,s=await(await fetch(i,{headers:{"X-API-Key":this.apiKey,"User-Agent":"ipwho-node-sdk/1.0.0"}})).json();if(!s.success)throw new Error(s.message||"Request failed");return s.data}async getIp(e){return this.fetcher(`/ip/${e}`)}async getMe(){return this.fetcher("/me")}};export{r as IPWho};
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "ipwho",
3
+ "version": "1.0.0",
4
+ "description": "SDK for IPWho API",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsup src/index.ts --format cjs,esm --minify --dts",
9
+ "test": "vitest run"
10
+ },
11
+ "devDependencies": {
12
+ "tsup": "^8.5.1",
13
+ "typescript": "^5.0.0",
14
+ "vitest": "^1.0.0"
15
+ }
16
+ }