https://github.com/safelyx/safelyx-js
JS Client for Safelyx's API. 🛡️🛜
https://github.com/safelyx/safelyx-js
ai content-moderation deno javascript jsr moderation node node-js nodejs open-source opensource sdk sdk-javascript sdk-js security-tools typescript
Last synced: 2 months ago
JSON representation
JS Client for Safelyx's API. 🛡️🛜
- Host: GitHub
- URL: https://github.com/safelyx/safelyx-js
- Owner: safelyx
- License: mit
- Created: 2025-02-02T11:38:57.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-02T14:16:54.000Z (8 months ago)
- Last Synced: 2025-03-28T17:48:45.574Z (6 months ago)
- Topics: ai, content-moderation, deno, javascript, jsr, moderation, node, node-js, nodejs, open-source, opensource, sdk, sdk-javascript, sdk-js, security-tools, typescript
- Language: TypeScript
- Homepage: https://safelyx.com/safe-api
- Size: 11.7 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Safelyx API
[](https://github.com/safelyx/safelyx-js/actions?workflow=Run+Tests) [](https://deno.land/x/safelyx) [](https://www.npmjs.com/package/@safelyx/api) [](https://jsr.io/@safelyx/api)
> 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.
### Some things to note:
1. It's simply making an HTTP request to the Safelyx API.
2. It provides types (and examples in JSDoc) for the results and for the parameters.
3. 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.
## Usage
It has a method per API endpoint.
### Deno
```ts
import safelyx from 'jsr:@safelyx/api@0.1.0'; // or import safelyx from 'https://deno.land/x/safelyx@0.1.0/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.
```### Node/NPM
```bash
npm install --save-exact @safelyx/api
``````js
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.
```## Development
Requires `deno`.
```bash
make format
make test
```## Publishing
After committing and pushing with a new version in `deno.json`, just run `make publish`.