Safelyx API client
Safelyx API client for Deno, Node/NPM and browser. It has no dependencies.
You can find the API documentation at https://safelyx.com/safe-api.
-
It's simply making an HTTP request to the Safelyx API.
-
It provides types (and examples in JSDoc) for the results and for the parameters.
-
If the request to the API fails (HTTP error), it will throw an error, so you might want to wrap it in a
try
/catch
block.
It has a method per API endpoint.
import safelyx from 'jsr:@safelyx/[email protected]'; // or import safelyx from 'https://deno.land/x/[email protected]/mod.ts';
const checkResult = await safelyx.checkLink('https://example.com');
console.log(checkResult.result); // Outputs a safety score between 0 (unsafe) and 10 (safe). -1 if there was an error, -2 if there are no checks remaining.
npm install --save-exact @safelyx/api
const safelyx = require('@safelyx/api'); // or import safelyx from '@safelyx/api';
const checkResult = await safelyx.checkLink('https://example.com');
console.log(checkResult.result); // Outputs a safety score between 0 (unsafe) and 10 (safe). -1 if there was an error, -2 if there are no checks remaining.
Requires deno
.
make format
make test
After committing and pushing with a new version in deno.json
, just run make publish
.