2 releases

new 0.1.1 Mar 7, 2025
0.1.0 Mar 7, 2025

#1790 in Web programming

ISC license

16KB
172 lines

Safelyx API

crate

Safelyx API client

Safelyx API client for Rust.

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's using the reqwest library to make the HTTP request.

  3. If the request to the API fails, it will return a Result with an error, so you can handle it using Rust's error handling patterns.

Usage

It has a method per API endpoint.

Rust

use safelyx;

fn main() {
    let check_result = safelyx::check_link("https://example.com", "your-key-code")
        .expect("Failed to check link");

    println!("{}", check_result.result);  // Outputs a safety score between 0 (unsafe) and 10 (safe). -1 if there was an error, -2 if there are no checks remaining.
}

Installation

Add this to your Cargo.toml:

[dependencies]
safelyx = "0.1"

Development

Requires Rust 1.70+.

make install
make format
make test

Publishing

After committing and pushing with a new version in Cargo.toml, just run:

make publish

Dependencies

~4–16MB
~199K SLoC