Runlight.Importers (runlight v0.1.0)

Copy Markdown View Source

Short links and their history from other shorteners: Umami, Dub, Bitly, Short.io, and Rebrandly (the SDK's importers). The dashboard drives an import a step at a time; each step fetches the next few links, writes each with its history, and reports progress, with a cursor to carry on from. Credentials come with every step and are never stored.

Summary

Functions

A browser's name as another tool wrote it, in Runlight's spelling.

A device as another tool wrote it, in Runlight's three.

The first length hex digits of SHA-256 of a value.

One step of an import from source: fetch the next few links, write each with its history, and report progress. The page calls again with the cursor until it comes back null.

The Runlight id an imported link gets, from its source and its id there.

Two destinations are the same link when they differ only by a trailing slash.

A system's name as another tool wrote it, in Runlight's spelling.

The first letter in upper case.

Writes one link and its history in a single transaction: the link (and its branded domain), then each click as a visit like a live one, or daily counts as clicks without visitors. Ids come from the source's own ids, so importing again skips what is already there. Answers %{status, clicks}, with reason, code, and params for a link that failed.

Functions

browser_name(value)

A browser's name as another tool wrote it, in Runlight's spelling.

device_name(value)

A device as another tool wrote it, in Runlight's three.

hex_id(value, length \\ 24)

The first length hex digits of SHA-256 of a value.

import_step(rl, site, source, credentials, cursor, done)

@spec import_step(
  Runlight.t(),
  String.t(),
  String.t(),
  map(),
  String.t() | nil,
  integer()
) ::
  Runlight.JS.Object.t()

One step of an import from source: fetch the next few links, write each with its history, and report progress. The page calls again with the cursor until it comes back null.

same_url?(a, b)

Two destinations are the same link when they differ only by a trailing slash.

system_name(value)

A system's name as another tool wrote it, in Runlight's spelling.

title(v)

The first letter in upper case.

write_link(rl, site, source, foreign, history)

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

Writes one link and its history in a single transaction: the link (and its branded domain), then each click as a visit like a live one, or daily counts as clicks without visitors. Ids come from the source's own ids, so importing again skips what is already there. Answers %{status, clicks}, with reason, code, and params for a link that failed.