Runlight.Links (runlight v0.1.0)

Copy Markdown View Source

Short links: create, change, delete, and import, with the rules every route shares (the SDK's links.ts). A link is a JavaScript object: id, site, domain ("" for the app's own), slug, name, url, createdAt, and updatedAt.

Summary

Functions

Makes a link for a site from %{"url", "name", "slug", "domain"} (the last three optional).

Creates many links at once, as from a CSV. Rows that fail are reported with their reason and the rest go in. Headers match the Umami fork's export: name or link_name, url or destination_url, slug or link_slug, domain or tracking_domain.

Six characters from an alphabet without look-alikes (no 0/o, 1/l).

Deletes a link; its clicks stay in the history.

Whether a slug may be used: letters, digits, dashes, and underscores, up to 100, starting with a letter or digit.

Changes a link: any of url, name, slug, and domain, the others as they were.

Functions

create(rl, site, input)

@spec create(Runlight.t(), String.t(), map()) :: Runlight.JS.Object.t()

Makes a link for a site from %{"url", "name", "slug", "domain"} (the last three optional).

import(rl, site, rows)

Creates many links at once, as from a CSV. Rows that fail are reported with their reason and the rest go in. Headers match the Umami fork's export: name or link_name, url or destination_url, slug or link_slug, domain or tracking_domain.

random_slug()

Six characters from an alphabet without look-alikes (no 0/o, 1/l).

remove(rl, id)

@spec remove(Runlight.t(), String.t()) :: :ok

Deletes a link; its clicks stay in the history.

slug?(value)

Whether a slug may be used: letters, digits, dashes, and underscores, up to 100, starting with a letter or digit.

update(rl, id, input)

@spec update(Runlight.t(), String.t(), map()) :: Runlight.JS.Object.t()

Changes a link: any of url, name, slug, and domain, the others as they were.