CipaWebFiltering (cipawebfiltering v1.0.0)

Copy Markdown View Source

Elixir client for the CIPA Web Filtering lookup API at https://www.cipawebfiltering.com/api/v1/ .

client = CipaWebFiltering.new(System.fetch_env!("CWF_API_KEY"))
{:ok, r} = CipaWebFiltering.classify(client, "example.com")
CipaWebFiltering.Policy.blocks?(CipaWebFiltering.Policy.statutory_core(), r.categories)

Functions return {:ok, value} or {:error, %CipaWebFiltering.Error{}}.

Summary

Functions

Database subscribers: key status and plan.

Largest batch per request.

Classify one domain or URL. One credit.

Classify any number of domains, sent in chunks of 1,000. Returns {:ok, results, credits}.

Database subscribers: last update time and size of the database file.

Service health. Free.

Build a client. Options: :base_url, :timeout (milliseconds).

Splits the API's "A|B|C" field, trimming and removing duplicates.

Types

t()

@type t() :: %CipaWebFiltering{api_key: term(), base_url: term(), timeout: term()}

Functions

account_status(c)

Database subscribers: key status and plan.

batch_max()

Largest batch per request.

classify(c, domain)

Classify one domain or URL. One credit.

classify_many(c, domains)

Classify any number of domains, sent in chunks of 1,000. Returns {:ok, results, credits}.

database_info(c)

Database subscribers: last update time and size of the database file.

health(c)

Service health. Free.

new(api_key, opts \\ [])

Build a client. Options: :base_url, :timeout (milliseconds).

split_categories(s)

Splits the API's "A|B|C" field, trimming and removing duplicates.