@hyphen/sdk 1.7.0 → 1.8.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.
- package/README.md +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -532,11 +532,12 @@ import { loadEnv } from '@hyphen/sdk';
|
|
|
532
532
|
loadEnv({ local: false });
|
|
533
533
|
```
|
|
534
534
|
|
|
535
|
-
# Net Info
|
|
535
|
+
# Net Info
|
|
536
536
|
|
|
537
537
|
The Hyphen Node.js SDK also provides a `NetInfo` class that allows you to fetch geo information about an IP address. This can be useful for debugging or logging purposes. You can read more about it:
|
|
538
538
|
|
|
539
539
|
* [Website](https://hyphen.ai/net-info)
|
|
540
|
+
* [https://net.info](https://net.info) - webservice uri used by the SDK
|
|
540
541
|
* [Quick Start Guide](https://docs.hyphen.ai/docs/netinfo-quickstart)
|
|
541
542
|
|
|
542
543
|
To use the `NetInfo` class, you can do the following:
|
|
@@ -551,6 +552,18 @@ const ipInfo = await netInfo.getIpInfo('8.8.8.8');
|
|
|
551
552
|
console.log('IP Info:', ipInfo);
|
|
552
553
|
```
|
|
553
554
|
|
|
555
|
+
If you want to fetch information for multiple IP addresses, you can do it like this:
|
|
556
|
+
|
|
557
|
+
```javascript
|
|
558
|
+
import { NetInfo } from '@hyphen/sdk';
|
|
559
|
+
const netInfo = new NetInfo({
|
|
560
|
+
apiKey: 'your_api_key',
|
|
561
|
+
});
|
|
562
|
+
const ips = ['8.8.8.8', '1.1.1.1'];
|
|
563
|
+
const ipInfos = await netInfo.getIpInfos(ips);
|
|
564
|
+
console.log('IP Infos:', ipInfos);
|
|
565
|
+
```
|
|
566
|
+
|
|
554
567
|
You can also set the API key using the `HYPHEN_API_KEY` environment variable. This is useful for keeping your API key secure and not hardcoding it in your code.
|
|
555
568
|
|
|
556
569
|
# Contributing
|